Markup

class markuptools.Markup(contents=None, direction=None, stack_priority=0)

A LilyPond markup.

Example 1. Initializes from string:

>>> string = r'\bold { "This is markup text." }'
>>> markup = Markup(string)
>>> show(markup) 

Example 2. Initializes from other markup:

>>> markup_1 = Markup('foo', direction=Up)
>>> markup_2 = Markup(markup_1, direction=Down)
>>> show(markup_2) 

Example 3. Attaches markup to score components:

>>> staff = Staff("c'8 d'8 e'8 f'8")
>>> string = r'\italic { "This is also markup text." }'
>>> markup = Markup(string, direction=Up)
>>> attach(markup, staff[0])
>>> show(staff) 

Set direction to Up, Down, 'neutral', '^', '_', '-' or None.

Markup objects are immutable.

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" [color=1, group=0, label=AbjadValueObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.abctools.AbjadValueObject.AbjadValueObject"; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_markuptools { graph [label=markuptools]; "abjad.tools.markuptools.Markup.Markup" [color=black, fontcolor=white, group=2, label=<<B>Markup</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" -> "abjad.tools.markuptools.Markup.Markup"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

bold() LilyPond \bold markup command.
box() LilyPond \box markup command.
bracket() LilyPond \bracket markup command.
caps() LilyPond \caps markup command.
center_align() LilyPond \center-align markup command.
center_column(markups[, direction]) LilyPond \center-column markup command.
circle() LilyPond \circle markup command.
column(markups[, direction]) LilyPond \column markup command.
combine(markup_one, markup_two) LilyPond \combine markup command.
concat(markup_list) LilyPond \concat markup command.
contents Gets contents of markup.
direction Gets direction of markup.
draw_circle(radius, thickness[, filled]) LilyPond \draw-circle markup command.
draw_line(x, y) LilyPond \draw-line markup command.
dynamic() LilyPond \dynamic markup command.
filled_box(x_extent, y_extent[, blot]) LilyPond filled-box markup command.
finger() LilyPond \finger markup command.
flat() LilyPond \flat markup command.
fontsize(fontsize) LilyPond \fontsize markup command.
fraction(numerator, denominator) LilyPond \fraction markup command.
general_align(axis, direction) LilyPond \general-align markup command.
halign(direction) LilyPond halign markup command.
hcenter_in(length) LilyPond \hcenter-in markup command.
hspace(amount) LilyPond \hspace markup command.
huge() LilyPond \huge markup command.
italic() LilyPond \italic markup command.
larger() LilyPond \larger markup command.
left_column(markups[, direction]) LilyPond \left-column markup command.
line(\*markups) LilyPond \line markup command.
make_big_centered_page_number_markup([text]) Makes big centered page number markup.
make_blank_line_markup() Makes blank line markup.
make_centered_title_markup(title[, ...]) Makes centered title markup.
make_improper_fraction_markup(rational) Makes improper fraction markup.
make_vertically_adjusted_composer_markup(...) Makes vertically adjusted composer markup.
musicglyph([glyph_name, direction]) LilyPond \musicglyph markup command.
natural() LilyPond \natural markup command.
note_by_number(log, dot_count, stem_direction) LilyPond \note-by-number markup command.
null([direction]) LilyPond \null markup command.
overlay(markups[, direction]) LilyPond \overlay markup command.
override(new_property) LilyPond \override markup command.
pad_around(padding) LilyPond \pad-around markup command.
pad_to_box(x_extent, y_extent) LilyPond pad-to-box markup command.
parenthesize() LilyPond \parenthesize markup command.
postscript(postscript) LilyPond \postscript markup command.
raise_(amount) LilyPond \raise markup command.
right_column(markups[, direction]) LilyPond \right-column markup command.
rotate(angle) LilyPond \rotate markup command.
sans() LilyPond \sans markup command.
scale(factor_pair) LilyPond \scale markup command.
sharp() LilyPond \sharp markup command.
small() LilyPond \small markup command.
smaller() LilyPond \smaller markup command.
stack_priority Gets stack priority of markup.
sub() LilyPond \sub markup command.
super_() LilyPond \super markup command.
tiny() LilyPond \tiny markup command.
translate(offset_pair) LilyPond translate markup command.
triangle([is_filled]) LilyPond \triangle markup command.
upright() LilyPond \upright markup command.
vcenter() LilyPond \vcenter markup command.
vspace(amount) LilyPond \vspace markup command.
whiteout() LilyPond \whiteout markup command.
with_color(color) LilyPond \with-color markup command.
with_dimensions(x_extent, y_extent) LilyPond with-dimensions markup command.
__add__(expr) Adds contents of this markup to expr.
__copy__(\*args) Copies Abjad value object.
__eq__(expr) Is true when all initialization values of Abjad value object equal the initialization values of expr.
__format__([format_specification]) Formats markup.
__hash__() Hashes Abjad value object.
__illustrate__() Illustrates markup.
__ne__(expr) Is true when Abjad object does not equal expr.
__repr__() Gets interpreter representation of Abjad object.
__str__() Gets string representation of markup.

Read-only properties

Markup.contents

Gets contents of markup.

>>> string = r'\bold { "This is markup text." }'
>>> markup = Markup(string)
>>> show(markup) 
>>> markup.contents
(MarkupCommand('bold', ['This is markup text.']),)

Returns tuple.

Markup.direction

Gets direction of markup.

>>> string = r'\bold { "This is markup text." }'
>>> markup = Markup(string, direction=Up)
>>> show(markup) 
>>> markup.direction
Up

Returns up, down, center or none.

Markup.stack_priority

Gets stack priority of markup.

Example 1. 'foo' appears higher in stack than 'bar':

>>> staff = Staff("c'8 d'8 e'8 f'8")
>>> attach(Markup('foo', stack_priority=1000), staff[1])
>>> attach(Markup('bar', stack_priority=0), staff[1])
>>> show(staff) 

Example 2. 'foo' appears lower in stack than 'bar':

>>> staff = Staff("c'8 d'8 e'8 f'8")
>>> attach(Markup('foo', stack_priority=0), staff[1])
>>> attach(Markup('bar', stack_priority=1000), staff[1])
>>> show(staff) 

Higher priority equals higher position.

Defaults to zero.

Set to integer.

Methods

Markup.bold()

LilyPond \bold markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.bold()
>>> print(format(markup))
\markup {
    \bold
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.box()

LilyPond \box markup command.

Example 1. Default box:

>>> markup = Markup('Allegro assai')
>>> markup = markup.box()
>>> print(format(markup))
\markup {
    \box
        "Allegro assai"
    }
>>> show(markup) 

Example 2. Customized box:

>>> markup = Markup('Allegro assai')
>>> markup = markup.box()
>>> markup = markup.override(('box-padding', 0.5))
>>> print(format(markup))
\markup {
    \override
        #'(box-padding . 0.5)
        \box
            "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.bracket()

LilyPond \bracket markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.bracket()
>>> print(format(markup))
\markup {
    \bracket
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.caps()

LilyPond \caps markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.caps()
>>> print(format(markup))
\markup {
    \caps
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.center_align()

LilyPond \center-align markup command.

>>> markup_a = Markup('one')
>>> markup_b = Markup('two').center_align()
>>> markup_c = Markup('three')
>>> markup = Markup.column([markup_a, markup_b, markup_c])
>>> print(format(markup))
\markup {
    \column
        {
            one
            \center-align
                two
            three
        }
    }
>>> show(markup) 

Returns new markup

Markup.circle()

LilyPond \circle markup command.

>>> markup = Markup.fraction(3, 5)
>>> markup = markup.circle()
>>> markup = markup.override(('circle-padding', 0.45))
>>> print(format(markup))
\markup {
    \override
        #'(circle-padding . 0.45)
        \circle
            \fraction
                3
                5
    }
>>> show(markup) 

Returns new markup

Markup.dynamic()

LilyPond \dynamic markup command.

>>> markup = Markup('sffz')
>>> markup = markup.dynamic()
>>> print(format(markup))
\markup {
    \dynamic
        sffz
    }
>>> show(markup) 

Returns new markup.

Markup.finger()

LilyPond \finger markup command.

>>> markup = Markup(1)
>>> markup = markup.finger()
>>> print(format(markup))
\markup {
    \finger
        1
    }
>>> show(markup) 

Returns new markup

Markup.fontsize(fontsize)

LilyPond \fontsize markup command.

>>> markup = Markup('foo')
>>> markup = markup.fontsize(-3)
>>> print(format(markup))
\markup {
    \fontsize
        #-3
        foo
    }
>>> show(markup) 

Returns new markup

Markup.general_align(axis, direction)

LilyPond \general-align markup command.

Example 1. With Abjad direction constant:

>>> markup = Markup('Allegro assai')
>>> markup = markup.general_align('Y', Up)
>>> print(format(markup))
\markup {
    \general-align
        #Y
        #UP
        "Allegro assai"
    }
>>> show(markup) 

Example 2. With numeric direction value:

>>> markup = Markup('Allegro assai')
>>> markup = markup.general_align('Y', 0.75)
>>> print(format(markup))
\markup {
    \general-align
        #Y
        #0.75
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.halign(direction)

LilyPond halign markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.halign(0)
>>> print(format(markup))
\markup {
    \halign
        #0
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.hcenter_in(length)

LilyPond \hcenter-in markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.hcenter_in(12)
>>> print(format(markup))
\markup {
    \hcenter-in
        #12
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.huge()

LilyPond \huge markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.huge()
>>> print(format(markup))
\markup {
    \huge
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.italic()

LilyPond \italic markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.italic()
>>> print(format(markup))
\markup {
    \italic
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.larger()

LilyPond \larger markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.larger()
>>> print(format(markup))
\markup {
    \larger
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.line(*markups)

LilyPond \line markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.line(Markup('ma'), Markup('non troppo'))
>>> print(format(markup))
\markup {
    \line
        {
            "Allegro assai"
            ma
            "non troppo"
        }
    }
>>> show(markup) 

Returns new markup.

Markup.override(new_property)

LilyPond \override markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.parenthesize()
>>> markup = markup.override(('padding', 0.75))
>>> f(markup)
\markup {
    \override
        #'(padding . 0.75)
        \parenthesize
            "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.pad_around(padding)

LilyPond \pad-around markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.pad_around(10)
>>> markup = markup.box()
>>> print(format(markup))
\markup {
    \box
        \pad-around
            #10
            "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.pad_to_box(x_extent, y_extent)

LilyPond pad-to-box markup command.

Example 1. Positive extents.

The following postscript describes a filled box between the x-coordinates of 0 and 10 and the y-coordinates of 0 and 10. Normally, this would be drawn off the edge of the page.

>>> up_postscript = markuptools.Postscript()
>>> up_postscript = up_postscript.newpath()
>>> up_postscript = up_postscript.moveto(0, 0)
>>> up_postscript = up_postscript.rlineto(10, 0)
>>> up_postscript = up_postscript.rlineto(0, 10)
>>> up_postscript = up_postscript.rlineto(-10, 0)
>>> up_postscript = up_postscript.closepath()
>>> up_postscript = up_postscript.setgray(0.75)
>>> up_postscript = up_postscript.fill()
>>> up_postscript_markup = up_postscript.as_markup()
>>> print(format(up_postscript_markup))
\markup {
    \postscript
        #"
        newpath
        0 0 moveto
        10 0 rlineto
        0 10 rlineto
        -10 0 rlineto
        closepath
        0.75 setgray
        fill
        "
    }

Notice how the top half of the square is cut off. The coordinates of the postscript put most of the drawing off the edge of the page. LilyPond does not know what the size of the postscript is, so it does not attempt to reposition it:

>>> show(up_postscript_markup) 

Wrapping the postscript in a box shows that LilyPond believes the postscript has effectively no x or y extent:

>>> show(up_postscript_markup.box()) 

By giving the postscript markup explicit extents, we can instruct LilyPond to position it properly:

>>> up_postscript_markup = up_postscript_markup.pad_to_box(
...     (0, 10), (0, 10))
>>> show(up_postscript_markup) 

Boxing also shows that extents have been applied correctly:

>>> show(up_postscript_markup.box()) 

Example 2. Negative extents.

LilyPond does not appear to handle negative extents in the same was as it handles positive extents.

The following postscript describes a box of the same shape as in the previous example. However, this box’s x- and y-coordinates range between 0 and 10 and 0 and -10 respectively.

>>> down_postscript = markuptools.Postscript()
>>> down_postscript = down_postscript.newpath()
>>> down_postscript = down_postscript.moveto(0, 0)
>>> down_postscript = down_postscript.rlineto(10, 0)
>>> down_postscript = down_postscript.rlineto(0, -10)
>>> down_postscript = down_postscript.rlineto(-10, 0)
>>> down_postscript = down_postscript.closepath()
>>> down_postscript = down_postscript.setgray(0.75)
>>> down_postscript = down_postscript.fill()
>>> down_postscript_markup = down_postscript.as_markup()
>>> print(format(down_postscript_markup))
\markup {
    \postscript
        #"
        newpath
        0 0 moveto
        10 0 rlineto
        0 -10 rlineto
        -10 0 rlineto
        closepath
        0.75 setgray
        fill
        "
    }

This time, the entire markup appears to display, without being cut off:

>>> show(down_postscript_markup) 

However, boxing the markup shows that LilyPond still believes it to be of 0-height and 0-width. Notice that the box appears in a different corner of the grey square than in the previous example. This corner is the markup origin. The grey box in example 2 descends from the origin, while the grey box in example 1 ascends from it.

>>> show(down_postscript_markup.box()) 

Giving the postscript markup positive extents does not work:

>>> markup = down_postscript_markup.pad_to_box(
...     (0, 10), (0, 10))
>>> show(markup.box()) 

Likewise, giving the postscript markup negative extents also does not work. The negative extents are treated as 0. In this case, the postscript markup is treated as though it had a height of 0:

>>> markup = down_postscript_markup.pad_to_box(
...     (0, 10), (0, -10))
>>> show(markup.box()) 

Unfortunately, this means that any part of a postscript-created markup that uses negative coordinates cannot be treated properly by LilyPond’s markup spacing logic. To avoid this, only use positive coordinates in postscript.

Returns new markup.

Markup.parenthesize()

LilyPond \parenthesize markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.parenthesize()
>>> f(markup)
\markup {
    \parenthesize
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.raise_(amount)

LilyPond \raise markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.raise_(0.35)
>>> print(format(markup))
\markup {
    \raise
        #0.35
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.rotate(angle)

LilyPond \rotate markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.rotate(45)
>>> print(format(markup))
\markup {
    \rotate
        #45
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.sans()

LilyPond \sans markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.sans()
>>> print(format(markup))
\markup {
    \sans
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.scale(factor_pair)

LilyPond \scale markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.scale((0.75, 0.75))
>>> print(format(markup))
\markup {
    \scale
        #'(0.75 . 0.75)
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.small()

LilyPond \small markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.small()
>>> print(format(markup))
\markup {
    \small
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.smaller()

LilyPond \smaller markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.smaller()
>>> print(format(markup))
\markup {
    \smaller
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.sub()

LilyPond \sub markup command.

>>> markups = [Markup('A'), Markup('j').sub()]
>>> markup = Markup.concat(markups)
>>> print(format(markup))
\markup {
    \concat
        {
            A
            \sub
                j
        }
    }
>>> show(markup) 

Returns new markup.

Markup.super_()

LilyPond \super markup command.

>>> markups = [Markup('1'), Markup('st').super_()]
>>> markup = Markup.concat(markups)
>>> print(format(markup))
\markup {
    \concat
        {
            1
            \super
                st
        }
    }
>>> show(markup) 

Returns new markup.

Markup.tiny()

LilyPond \tiny markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.tiny()
>>> print(format(markup))
\markup {
    \tiny
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.translate(offset_pair)

LilyPond translate markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.translate((2, 1))
>>> print(format(markup))
\markup {
    \translate
        #'(2 . 1)
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.upright()

LilyPond \upright markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.upright()
>>> print(format(markup))
\markup {
    \upright
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.vcenter()

LilyPond \vcenter markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.vcenter()
>>> print(format(markup))
\markup {
    \vcenter
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.whiteout()

LilyPond \whiteout markup command.

Returns new markup.

Markup.with_color(color)

LilyPond \with-color markup command.

>>> markup = Markup('Allegro assai')
>>> markup = markup.with_color('blue')
>>> print(format(markup))
\markup {
    \with-color
        #blue
        "Allegro assai"
    }
>>> show(markup) 

Returns new markup.

Markup.with_dimensions(x_extent, y_extent)

LilyPond with-dimensions markup command.

Note

See the API entry for Markup.pad_to_box() for an extensive discussion of setting explicit markup extents.

Example 1.

>>> up_postscript = markuptools.Postscript()
>>> up_postscript = up_postscript.newpath()
>>> up_postscript = up_postscript.moveto(0, 0)
>>> up_postscript = up_postscript.rlineto(10, 0)
>>> up_postscript = up_postscript.rlineto(0, 10)
>>> up_postscript = up_postscript.rlineto(-10, 0)
>>> up_postscript = up_postscript.closepath()
>>> up_postscript = up_postscript.setgray(0.75)
>>> up_postscript = up_postscript.fill()
>>> up_markup = up_postscript.as_markup()
>>> show(up_markup.box()) 
>>> up_markup = up_markup.with_dimensions((0, 10), (0, 10))
>>> up_markup = up_markup.box()
>>> show(up_markup) 
>>> up_markup = up_postscript.as_markup()
>>> up_markup = up_markup.with_dimensions((0, 20), (0, 20))
>>> up_markup = up_markup.box()
>>> show(up_markup) 
>>> up_markup = up_postscript.as_markup()
>>> up_markup = up_markup.with_dimensions((0, 20), (0, -20))
>>> up_markup = up_markup.box()
>>> show(up_markup) 

Example 2.

>>> down_postscript = markuptools.Postscript()
>>> down_postscript = down_postscript.newpath()
>>> down_postscript = down_postscript.moveto(0, 0)
>>> down_postscript = down_postscript.rlineto(10, 0)
>>> down_postscript = down_postscript.rlineto(0, -10)
>>> down_postscript = down_postscript.rlineto(-10, 0)
>>> down_postscript = down_postscript.closepath()
>>> down_postscript = down_postscript.setgray(0.75)
>>> down_postscript = down_postscript.fill()
>>> down_markup = down_postscript.as_markup()
>>> show(down_markup.box()) 
>>> down_markup = down_markup.with_dimensions((0, 10), (0, 10))
>>> down_markup = down_markup.box()
>>> show(down_markup) 
>>> down_markup = down_postscript.as_markup()
>>> down_markup = down_markup.with_dimensions(
...     (0, 10), (0, -10))
>>> down_markup = down_markup.box()
>>> show(down_markup) 
>>> down_markup = down_postscript.as_markup()
>>> down_markup = down_markup.with_dimensions(
...     (-5, 15), (5, -15))
>>> down_markup = down_markup.box()
>>> show(down_markup) 

Returns new markup.

Class & static methods

static Markup.center_column(markups, direction=None)

LilyPond \center-column markup command.

>>> city = Markup('Los Angeles')
>>> date = Markup('May - August 2014')
>>> markup = Markup.center_column([city, date])
>>> print(format(markup))
\markup {
    \center-column
        {
            "Los Angeles"
            "May - August 2014"
        }
    }
>>> show(markup) 

Also works with a list of strings:

>>> city = 'Los Angeles'
>>> date = 'May - August 2014'
>>> markup = Markup.center_column([city, date])
>>> print(format(markup))
\markup {
    \center-column
        {
            "Los Angeles"
            "May - August 2014"
        }
    }

Returns new markup.

static Markup.column(markups, direction=None)

LilyPond \column markup command.

>>> city = Markup('Los Angeles')
>>> date = Markup('May - August 2014')
>>> markup = Markup.column([city, date])
>>> print(format(markup))
\markup {
    \column
        {
            "Los Angeles"
            "May - August 2014"
        }
    }
>>> show(markup) 

Returns new markup.

static Markup.combine(markup_one, markup_two)

LilyPond \combine markup command.

>>> markup_one = Markup('a few words')
>>> markup_two = Markup.draw_line(10, 0)
>>> markup = Markup.combine(markup_one, markup_two)
>>> print(format(markup))
\markup {
    \combine
        "a few words"
        \draw-line
            #'(10 . 0)
    }
>>> show(markup) 

Returns new markup.

static Markup.concat(markup_list)

LilyPond \concat markup command.

>>> downbow = Markup.musicglyph('scripts.downbow')
>>> hspace = Markup.hspace(1)
>>> upbow = Markup.musicglyph('scripts.upbow')
>>> markup = Markup.concat([downbow, hspace, upbow])
>>> print(format(markup))
\markup {
    \concat
        {
            \musicglyph
                #"scripts.downbow"
            \hspace
                #1
            \musicglyph
                #"scripts.upbow"
        }
    }
>>> show(markup) 

Returns new markup.

static Markup.draw_circle(radius, thickness, filled=False)

LilyPond \draw-circle markup command.

>>> markup = Markup.draw_circle(10, 1.5)
>>> print(format(markup))
\markup {
    \draw-circle
        #10
        #1.5
        ##f
    }
>>> show(markup) 

Returns new markup

static Markup.draw_line(x, y)

LilyPond \draw-line markup command.

>>> markup = Markup.draw_line(5, -2.5)
>>> print(format(markup))
\markup {
    \draw-line
        #'(5 . -2.5)
    }
>>> show(markup) 

Returns new markup

static Markup.filled_box(x_extent, y_extent, blot=0)

LilyPond filled-box markup command.

>>> markup = Markup.filled_box((0, 10), (2, 5), 1.5)
>>> print(format(markup))
\markup {
    \filled-box
        #'(0 . 10)
        #'(2 . 5)
        #1.5
    }
>>> show(markup) 

Returns new markup.

static Markup.flat()

LilyPond \flat markup command.

>>> markup = Markup.flat()
>>> print(format(markup))
\markup {
    \flat
    }
>>> show(markup) 

Returns new markup.

static Markup.fraction(numerator, denominator)

LilyPond \fraction markup command.

Example 1. Fraction with integer numerator and denominator:

>>> markup = Markup.fraction(1, 4)
>>> show(markup) 

Example 2. Fraction with string numerator and integer denominator:

>>> markup = Markup.fraction('π', 4)
>>> show(markup) 

Returns new markup

static Markup.hspace(amount)

LilyPond \hspace markup command.

>>> markup = Markup.hspace(0.75)
>>> f(markup)
\markup {
    \hspace
        #0.75
    }
>>> show(markup) 

Returns new markup.

static Markup.left_column(markups, direction=None)

LilyPond \left-column markup command.

>>> city = Markup('Los Angeles')
>>> date = Markup('May - August 2014')
>>> markup = Markup.left_column([city, date])
>>> print(format(markup))
\markup {
    \left-column
        {
            "Los Angeles"
            "May - August 2014"
        }
    }
>>> show(markup) 

Returns new markup.

static Markup.make_big_centered_page_number_markup(text=None)

Makes big centered page number markup.

>>> markup = Markup.make_big_centered_page_number_markup()
>>> print(format(markup, 'lilypond'))
\markup {
    \fill-line
        {
            \bold
                \fontsize
                    #3
                    \concat
                        {
                            \on-the-fly
                                #print-page-number-check-first
                                \fromproperty
                                    #'page:page-number-string
                        }
        }
    }

Returns markup.

static Markup.make_blank_line_markup()

Makes blank line markup.

>>> markup = Markup.make_blank_line_markup()
>>> print(format(markup))
\markup {
    \fill-line
        {
            " "
        }
    }
>>> show(markup) 

Returns markup.

static Markup.make_centered_title_markup(title, font_name='Times New Roman', font_size=18, vspace_before=6, vspace_after=12)

Makes centered title markup.

>>> markup = Markup.make_centered_title_markup('String Quartet')
>>> print(format(markup, 'lilypond'))
\markup {
    \override
        #'(font-name . "Times New Roman")
        \fontsize
            #18
            \column
                {
                    \center-align
                        {
                            {
                                \vspace
                                    #6
                                \line
                                    {
                                        "String Quartet"
                                    }
                                \vspace
                                    #12
                            }
                        }
                }
    }
>>> show(markup) 

Returns markup.

static Markup.make_improper_fraction_markup(rational)

Makes improper fraction markup.

Example 1. With integer-equivalent number:

>>> markup = Markup.make_improper_fraction_markup(Fraction(6, 3))
>>> print(format(markup))
\markup { 2 }
>>> show(markup) 

Example 2. With non-integer-equivalent number:

>>> markup = Markup.make_improper_fraction_markup(Fraction(7, 3))
>>> print(format(markup))
\markup {
    2
    \tiny
        \fraction
            1
            3
    }
>>> show(markup) 
static Markup.make_vertically_adjusted_composer_markup(composer, font_name='Times New Roman', font_size=3, space_above=20, space_right=0)

Makes vertically adjusted composer markup.

>>> markup = Markup.make_vertically_adjusted_composer_markup(
...     'Josquin Desprez',
...     )
>>> print(format(markup, 'lilypond'))
\markup {
    \override
        #'(font-name . "Times New Roman")
        {
            \hspace
                #0
            \raise
                #-20
                \fontsize
                    #3
                    "Josquin Desprez"
            \hspace
                #0
        }
    }
>>> show(markup) 

Returns markup.

static Markup.musicglyph(glyph_name=None, direction=None)

LilyPond \musicglyph markup command.

>>> markup = Markup.musicglyph('accidentals.sharp')
>>> print(format(markup))
\markup {
    \musicglyph
        #"accidentals.sharp"
    }
>>> show(markup) 

Returns new markup.

static Markup.natural()

LilyPond \natural markup command.

>>> markup = Markup.natural()
>>> print(format(markup))
\markup {
    \natural
    }
>>> show(markup) 

Returns new markup.

static Markup.note_by_number(log, dot_count, stem_direction, direction=None)

LilyPond \note-by-number markup command.

>>> markup = Markup.note_by_number(3, 2, 1)
>>> print(format(markup))
\markup {
    \note-by-number
        #3
        #2
        #1
    }
>>> show(markup) 

Returns new markup.

static Markup.null(direction=None)

LilyPond \null markup command.

>>> markup = Markup.null()
>>> print(format(markup))
\markup {
    \null
    }
>>> show(markup) 

Returns new markup.

static Markup.overlay(markups, direction=None)

LilyPond \overlay markup command.

>>> city = Markup('Los Angeles')
>>> date = Markup('May - August 2014')
>>> markup = Markup.overlay([city, date])
>>> print(format(markup))
\markup {
    \overlay
        {
            "Los Angeles"
            "May - August 2014"
        }
    }
>>> show(markup) 

Returns new markup.

static Markup.postscript(postscript)

LilyPond \postscript markup command.

>>> postscript = markuptools.Postscript()
>>> postscript = postscript.moveto(1, 1)
>>> postscript = postscript.setlinewidth(2.5)
>>> postscript = postscript.setdash((2, 1))
>>> postscript = postscript.lineto(3, -4)
>>> postscript = postscript.stroke()
>>> markup = markuptools.Markup.postscript(postscript)
>>> print(format(markup))
\markup {
    \postscript
        #"
        1 1 moveto
        2.5 setlinewidth
        [ 2 1 ] 0 setdash
        3 -4 lineto
        stroke
        "
    }
>>> show(markup) 

Returns new markup.

static Markup.right_column(markups, direction=None)

LilyPond \right-column markup command.

>>> city = Markup('Los Angeles')
>>> date = Markup('May - August 2014')
>>> markup = Markup.right_column([city, date])
>>> print(format(markup))
\markup {
    \right-column
        {
            "Los Angeles"
            "May - August 2014"
        }
    }
>>> show(markup) 

Returns new markup.

static Markup.sharp()

LilyPond \sharp markup command.

>>> markup = Markup.sharp()
>>> print(format(markup))
\markup {
    \sharp
    }
>>> show(markup) 

Returns new markup.

static Markup.triangle(is_filled=True)

LilyPond \triangle markup command.

>>> markup = Markup.triangle()
>>> print(format(markup))
\markup {
    \triangle
        ##t
    }
>>> show(markup) 

Returns new markup

static Markup.vspace(amount)

LilyPond \vspace markup command.

>>> markup = Markup.vspace(0.75)
>>> f(markup)
\markup {
    \vspace
        #0.75
    }
>>> show(markup) 

Returns new markup.

Special methods

Markup.__add__(expr)

Adds contents of this markup to expr.

Example 1. Adds markup to markup:

>>> Markup('foo') + Markup('bar')
Markup(contents=('foo', 'bar'))

Example 2. Adds markup command to markup:

>>> Markup('foo') + Markup.hspace(0.75)
Markup(contents=('foo', MarkupCommand('hspace', 0.75)))

Returns new markup.

(AbjadValueObject).__copy__(*args)

Copies Abjad value object.

Returns new Abjad value object.

(AbjadValueObject).__eq__(expr)

Is true when all initialization values of Abjad value object equal the initialization values of expr.

Returns true or false.

Markup.__format__(format_specification='')

Formats markup.

>>> string = r'\bold { allegro ma non troppo }'
>>> markup = Markup(string)
>>> print(format(markup))
\markup {
    \bold
        {
            allegro
            ma
            non
            troppo
        }
    }

Set format_specification to ‘’, ‘lilypond’ or ‘storage’. Interprets ‘’ equal to ‘lilypond’.

Returns string.

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

Markup.__illustrate__()

Illustrates markup.

>>> string = r'\bold { allegro ma non troppo }'
>>> markup = Markup(string)
>>> show(markup) 

Returns LilyPond file.

(AbjadObject).__ne__(expr)

Is true when Abjad object does not equal expr. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

Markup.__str__()

Gets string representation of markup.

>>> string = r'\bold { allegro ma non troppo }'
>>> markup = Markup(string)
>>> print(str(markup))
\markup {
    \bold
        {
            allegro
            ma
            non
            troppo
        }
    }

Returns string.