4.1.5 Horizontal spacing \paper variables

Note: Some \paper dimensions are automatically scaled to the paper size, which may lead to unexpected behavior. See Automatic scaling to paper size.


\paper variables for widths and margins

Default values (before scaling) that are not listed here are defined in ‘ly/paper-defaults-init.ly’.

paper-width

The width of the page, unset by default. While paper-width has no effect on the automatic scaling of some horizontal dimensions, it does influence the line-width variable. If both paper-width and line-width are set, then left-margin and right-margin will also be updated. Also see check-consistency.

line-width

When specified in a \paper block this defines the horizontal extent available for the staff lines in un-indented systems. If left unspecified, the paper’s line-width is determined from (paper-width - left-margin - right-margin). If the paper’s line-width is specified, and both left-margin and right-margin are not, then the margins will be updated to center the systems on the page automatically. Also see check-consistency.

line-widths for individual scores can be specified in the scores’ \layout blocks. These values control the width of the lines produced on a score-by-score basis. If line-width is not specified for a score, it defaults to the paper’s line-width. Setting a score’s line-width has no effect on the paper margins. Staff lines, of a length determined by the score’s line-width, are left-aligned within the paper area defined by the paper’s line-width. If the score and paper line-widths are equal, the staff lines will extend exactly from the left margin to the right margin, but if the score’s line-width is greater than the paper’s line-width the staff lines will run over into the right margin.

left-margin

The margin between the left edge of the page and the start of the staff lines in unindented systems. If the paper size is modified, this dimension’s default value is scaled accordingly. If left-margin is unset, and both line-width and right-margin are set, then left-margin is set to (paper-width - line-width - right-margin). If only line-width is set, then both margins are set to ((paper-width - line-width) / 2), and the systems are consequently centered on the page. Also see check-consistency.

right-margin

The margin between the right edge of the page and the end of the staff lines in non-ragged systems. If the paper size is modified, this dimension’s default value is scaled accordingly. If right-margin is unset, and both line-width and left-margin are set, then right-margin is set to (paper-width - line-width - left-margin). If only line-width is set, then both margins are set to ((paper-width - line-width) / 2), and the systems are consequently centered on the page. Also see check-consistency.

check-consistency

If this is true (the default value), print a warning if left-margin, line-width, and right-margin do not exactly add up to paper-width, and replace each of these (except paper-width) with their default values (scaled to the paper size if necessary). If set to false, ignore any inconsistencies and allow systems to run off the edge of the page.

ragged-right

If set to true, systems will not fill the line width. Instead, systems end at their natural horizontal length. Default: #t for scores with only one system, and #f for scores with two or more systems. This variable can also be set in a \layout block.

ragged-last

If set to true, the last system in the score will not fill the line width. Instead the last system ends at its natural horizontal length. Default: #f. This variable can also be set in a \layout block.

See also

Notation Reference: Automatic scaling to paper size.

Installed Files: ‘ly/paper-defaults-init.ly’.

Known issues and warnings

Explicitly defined paper-sizes will override any user-defined left or right margin settings.


\paper variables for two-sided mode

Default values (before scaling) are defined in ‘ly/paper-defaults-init.ly’.

two-sided

If set to true, use inner-margin, outer-margin and binding-offset to determine margins depending on whether the page number is odd or even. This overrides left-margin and right-margin.

inner-margin

The margin all pages have at the inner side if they are part of a book. If the paper size is modified, this dimension’s default value is scaled accordingly. Works only with two-sided set to true.

outer-margin

The margin all pages have at the outer side if they are part of a book. If the paper size is modified, this dimension’s default value is scaled accordingly. Works only with two-sided set to true.

binding-offset

The amount inner-margin is increased to make sure nothing will be hidden by the binding. If the paper size is modified, this dimension’s default value is scaled accordingly. Works only with two-sided set to true.

See also

Notation Reference: Automatic scaling to paper size.

Installed Files: ‘ly/paper-defaults-init.ly’.


\paper variables for shifts and indents

Default values (before scaling) that are not listed here are defined in ‘ly/paper-defaults-init.ly’.

horizontal-shift

The amount that all systems (including titles and system separators) are shifted to the right. Default: 0.0\mm.

indent

The level of indentation for the first system in a score. If the paper size is modified, this dimension’s default value is scaled accordingly. The space within line-width available for the first system is reduced by this amount. indent may also be specified in \layout blocks to set indents on a score-by-score basis.

short-indent

The level of indentation for all systems in a score besides the first system. If the paper size is modified, this dimension’s default value is scaled accordingly. The space within line-width available for systems other than the first is reduced by this amount. short-indent may also be specified in \layout blocks to set short indents on a score-by-score basis.

See also

Notation Reference: Automatic scaling to paper size.

Installed Files: ‘ly/paper-defaults-init.ly’.

Snippets: Spacing.


Jiné jazyky: català, deutsch, español, français, italiano.
About automatic language selection.

LilyPond — Notation Reference v2.21.0 (Vývojářská větev).