On properties

The layout and props arguments of markup commands bring a context for the markup interpretation: font size, line width, etc.

The layout argument allows access to properties defined in paper blocks, using the ly:output-def-lookup function. For instance, the line width (the same as the one used in scores) is read using:

(ly:output-def-lookup layout 'line-width)

The props argument makes some properties accessible to markup commands. For instance, when a book title markup is interpreted, all the variables defined in the \header block are automatically added to props, so that the book title markup can access the book title, composer, etc. It is also a way to configure the behavior of a markup command: for example, when a command uses font size during processing, the font size is read from props rather than having a font-size argument. The caller of a markup command may change the value of the font size property in order to change the behavior. Use the #:properties keyword of define-markup-command to specify which properties shall be read from the props arguments.

The example in next section illustrates how to access and override properties in a markup command.

Extending LilyPond v2.25.21 (development-branch).