A.10.3 Graphic

\arrow-head axis (integer) dir (direction) filled (boolean)

Produce an arrow head in specified direction and axis. Use the filled head if filled is specified.

\markup {
  \fontsize #5 {
    \general-align #Y #DOWN {
      \arrow-head #Y #UP ##t
      \arrow-head #Y #DOWN ##f
      \hspace #2
      \arrow-head #X #RIGHT ##f
      \arrow-head #X #LEFT ##f
    }
  }
}

[image of music]

\beam width (number) slope (number) thickness (number)

Create a beam with the specified parameters.

\markup {
  \beam #5 #1 #2
}

[image of music]

\bracket arg (markup)

Draw vertical brackets around arg.

\markup {
  \bracket {
    \note {2.} #UP
  }
}

[image of music]

\circle arg (markup)

Draw a circle around arg. Use thickness, circle-padding and font-size properties to determine line thickness and padding around the markup.

\markup {
  \circle {
    Hi
  }
}

[image of music]

Used properties:

  • circle-padding (0.2)
  • font-size (0)
  • thickness (1)
\draw-circle radius (number) thickness (number) filled (boolean)

A circle of radius radius and thickness thickness, optionally filled.

\markup {
  \draw-circle #2 #0.5 ##f
  \hspace #2
  \draw-circle #2 #0 ##t
}

[image of music]

\draw-dashed-line dest (pair of numbers)

A dashed line.

If full-length is set to #t (default) the dashed-line extends to the whole length given by dest, without white space at beginning or end. off will then be altered to fit. To insist on the given (or default) values of on, off use \override #'(full-length . #f) Manual settings for on,off and phase are possible.

\markup {
  \draw-dashed-line #'(5.1 . 2.3)
  \override #'((on . 0.3) (off . 0.5))
  \draw-dashed-line #'(5.1 . 2.3)
}

[image of music]

Used properties:

  • full-length (#t)
  • phase (0)
  • off (1)
  • on (1)
  • thickness (1)
\draw-dotted-line dest (pair of numbers)

A dotted line.

The dotted-line always extends to the whole length given by dest, without white space at beginning or end. Manual settings for off are possible to get larger or smaller space between the dots. The given (or default) value of off will be altered to fit the line-length.

\markup {
  \draw-dotted-line #'(5.1 . 2.3)
  \override #'((thickness . 2) (off . 0.2))
  \draw-dotted-line #'(5.1 . 2.3)
}

[image of music]

Used properties:

  • phase (0)
  • off (1)
  • thickness (1)
\draw-hline

Draws a line across a page, where the property span-factor controls what fraction of the page is taken up.

\markup {
  \column {
    \draw-hline
    \override #'(span-factor . 1/3)
    \draw-hline
  }
}

[image of music]

Used properties:

  • span-factor (1)
  • line-width
  • thickness (1)
\draw-line dest (pair of numbers)

A simple line.

\markup {
  \draw-line #'(4 . 4)
  \override #'(thickness . 5)
  \draw-line #'(-3 . 0)
}

[image of music]

Used properties:

  • thickness (1)
\draw-squiggle-line sq-length (number) dest (pair of numbers) eq-end? (boolean)

A squiggled line.

If eq-end? is set to #t, it is ensured the squiggled line ends with a bow in same direction as the starting one. sq-length is the length of the first bow. dest is the end point of the squiggled line. To match dest the squiggled line is scaled accordingly. Its appearance may be customized by overrides for thickness, angularity, height and orientation.

\markup
  \column {
    \draw-squiggle-line #0.5 #'(6 . 0) ##t
    \override #'(orientation . -1)
    \draw-squiggle-line #0.5 #'(6 . 0) ##t
    \draw-squiggle-line #0.5 #'(6 . 0) ##f
    \override #'(height . 1)
    \draw-squiggle-line #0.5 #'(6 . 0) ##t
    \override #'(thickness . 5)
    \draw-squiggle-line #0.5 #'(6 . 0) ##t
    \override #'(angularity . 2)
    \draw-squiggle-line #0.5 #'(6 . 0) ##t
  }

[image of music]

Used properties:

  • orientation (1)
  • height (0.5)
  • angularity (0)
  • thickness (0.5)
\ellipse arg (markup)

Draw an ellipse around arg. Use thickness, x-padding, y-padding and font-size properties to determine line thickness and padding around the markup.

\markup {
  \ellipse {
    Hi
  }
}

[image of music]

Used properties:

  • y-padding (0.2)
  • x-padding (0.2)
  • font-size (0)
  • thickness (1)
\epsfile axis (number) size (number) file-name (string)

Inline an EPS image. The image is scaled along axis to size.

\markup {
  \general-align #Y #DOWN {
    \epsfile #X #20 #"context-example.eps"
    \epsfile #Y #20 #"context-example.eps"
  }
}

[image of music]

\filled-box xext (pair of numbers) yext (pair of numbers) blot (number)

Draw a box with rounded corners of dimensions xext and yext. For example,

\filled-box #'(-.3 . 1.8) #'(-.3 . 1.8) #0

creates a box extending horizontally from -0.3 to 1.8 and vertically from -0.3 up to 1.8, with corners formed from a circle of diameter 0 (i.e., sharp corners).

\markup {
  \filled-box #'(0 . 4) #'(0 . 4) #0
  \filled-box #'(0 . 2) #'(-4 . 2) #0.4
  \combine
  \filled-box #'(1 . 8) #'(0 . 7) #0.2
  \with-color #white
  \filled-box #'(3.6 . 5.6) #'(3.5 . 5.5) #0.7
}

[image of music]

\hbracket arg (markup)

Draw horizontal brackets around arg.

\markup {
  \hbracket {
    \line {
      one two three
    }
  }
}

[image of music]

\oval arg (markup)

Draw an oval around arg. Use thickness, x-padding, y-padding and font-size properties to determine line thickness and padding around the markup.

\markup {
  \oval {
    Hi
  }
}

[image of music]

Used properties:

  • y-padding (0.75)
  • x-padding (0.75)
  • font-size (0)
  • thickness (1)
\parenthesize arg (markup)

Draw parentheses around arg. This is useful for parenthesizing a column containing several lines of text.

\markup {
  \parenthesize
  \column {
    foo
    bar
  }
  \override #'(angularity . 2)
  \parenthesize
  \column {
    bah
    baz
  }
}

[image of music]

Used properties:

  • width (0.25)
  • line-thickness (0.1)
  • thickness (1)
  • size (1)
  • padding
  • angularity (0)
\path thickness (number) commands (list)

Draws a path with line thickness according to the directions given in commands. commands is a list of lists where the car of each sublist is a drawing command and the cdr comprises the associated arguments for each command.

There are seven commands available to use in the list commands: moveto, rmoveto, lineto, rlineto, curveto, rcurveto, and closepath. Note that the commands that begin with r are the relative variants of the other three commands. You may also use the standard SVG single-letter equivalents: moveto = M, lineto = L, curveto = C, closepath = Z. The relative commands are written lowercase: rmoveto = r, rlineto = l, rcurveto = c.

The commands moveto, rmoveto, lineto, and rlineto take 2 arguments; they are the X and Y coordinates for the destination point.

The commands curveto and rcurveto create cubic Bézier curves, and take 6 arguments; the first two are the X and Y coordinates for the first control point, the second two are the X and Y coordinates for the second control point, and the last two are the X and Y coordinates for the destination point.

The closepath command takes zero arguments and closes the current subpath in the active path.

Line-cap styles and line-join styles may be customized by overriding the line-cap-style and line-join-style properties, respectively. Available line-cap styles are 'butt, 'round, and 'square. Available line-join styles are 'miter, 'round, and 'bevel.

The property filled specifies whether or not the path is filled with color.

samplePath =
  #'((lineto -1 1)
     (lineto 1 1)
     (lineto 1 -1)
     (curveto -5 -5 -5 5 -1 0)
     (closepath))

\markup {
  \path #0.25 #samplePath

  \override #'(line-join-style . miter)
  \path #0.25 #samplePath

  \override #'(filled . #t)
  \path #0.25 #samplePath
}

[image of music]

Used properties:

  • filled (#f)
  • line-join-style (round)
  • line-cap-style (round)
\polygon points (list of number pairs)

A polygon delimited by the list of points. extroversion defines how the shape of the polygon is adapted to its thickness. If it is 0, the polygon is traced as-is. If -1, the outer side of the line is just on the given points. If 1, the line has its inner side on the points. The thickness property controls the thickness of the line; for filled polygons, this means the diameter of the blot.

regularPentagon =
  #'((1 . 0) (0.31 . 0.95) (-0.81 . 0.59)
     (-0.81 . -0.59) (0.31 . -0.95))

\markup {
  \polygon #'((-1 . -1) (0 . -3) (2 . 2) (1 . 2))
  \override #'(filled . #f)
    \override #'(thickness . 2)
      \combine
        \with-color #(universal-color 'blue)
          \polygon #regularPentagon
        \with-color #(universal-color 'vermillion)
          \override #'(extroversion . 1)
            \polygon #regularPentagon
}

[image of music]

Used properties:

  • thickness (1)
  • filled (#t)
  • extroversion (0)
\postscript str (string)

Insert str directly into the output as a PostScript command string.

This command is meant as a last resort. Almost all needs are better fulfilled by other markup commands (see, for example, \path and \draw-line). If you do use this command, keep the following points in mind:

  • \postscript does not work in SVG output.
  • There are no stability guarantees on the details of how LilyPond produces its own output (i.e., the context into which the PostScript code is inserted). They may change substantially across versions.
  • LilyPond cannot understand the shape of the drawing, leading to suboptimal spacing.
  • Depending on how you install LilyPond, the version of the PostScript interpreter (GhostScript) can vary, and some of its features may be disabled.
ringsps = #"
  0.15 setlinewidth
  0.9 0.6 moveto
  0.4 0.6 0.5 0 361 arc
  stroke
  1.0 0.6 0.5 0 361 arc
  stroke
  "

rings = \markup {
  \with-dimensions #'(-0.2 . 1.6) #'(0 . 1.2)
  \postscript #ringsps
}

\relative c'' {
  c2^\rings
  a2_\rings
}

[image of music]

\rounded-box arg (markup)

Draw a box with rounded corners around arg. Looks at thickness, box-padding and font-size properties to determine line thickness and padding around the markup; the corner-radius property makes it possible to define another shape for the corners (default is 1).

c4^\markup {
  \rounded-box {
    Overtura
  }
}
c,8. c16 c4 r

[image of music]

Used properties:

  • box-padding (0.5)
  • font-size (0)
  • corner-radius (1)
  • thickness (1)
\scale factor-pair (pair of numbers) arg (markup)

Scale arg. factor-pair is a pair of numbers representing the scaling-factor in the X and Y axes. Negative values may be used to produce mirror images.

\markup {
  \line {
    \scale #'(2 . 1)
    stretched
    \scale #'(1 . -1)
    mirrored
  }
}

[image of music]

\triangle filled (boolean)

A triangle, either filled or empty.

\markup {
  \triangle ##t
  \hspace #2
  \triangle ##f
}

[image of music]

Used properties:

  • thickness (1)
  • font-size (0)
  • extroversion (0)
\with-url url (string) arg (markup)

Add a link to URL url around arg. This only works in the PDF backend.

\markup {
  \with-url #"https://lilypond.org/" {
    LilyPond ... \italic {
      music notation for everyone
    }
  }
}

[image of music]


LilyPond – Notationsreferenz v2.24.4 (stabiler Zweig).