4.1.2 Paper size and automatic scaling


Setting the paper size

‘A4’ is the default value when no explicit paper size is set. However, there are two functions that can be used to change it:

set-default-paper-size
#(set-default-paper-size "quarto")

which must always be placed at the toplevel scope, and

set-paper-size
\paper {
  #(set-paper-size "tabloid")
}

which must always be placed in a \paper block.

If the set-default-paper-size function is used in the toplevel scope, it must come before any \paper block. set-default-paper-size sets the paper size for all pages, whereas set-paper-size only sets the paper size for the pages that the \paper block applies to. For example, if the \paper block is at the top of the file, then it applies the paper size to all pages. If the \paper block is inside a \book, then the paper size applies only to that book.

When the set-paper-size function is used, it must be placed before any other functions used within the same \paper block. See Automatic scaling to paper size.

Paper sizes are defined in file ‘scm/paper.scm’; see Predefined paper sizes for a complete list.

Both set-default-paper-size and set-paper-size also accept a quoted number pair as its argument to set a custom paper size. For example,

#(set-default-paper-size '(cons (* 100 mm) (* 50 mm)))

sets the paper width and height to 100mm and 50mm, respectively.

Possible units are in (inches), cm (centimeters), mm (millimeters), pt (points), and bp (big points).

If the symbol 'landscape is added to the paper size function as a second argument, pages are rotated by 90 degrees, and wider line widths are set accordingly.

#(set-default-paper-size "a6" 'landscape)

Swapping the paper dimensions without having the print rotated (like when printing to postcard size, or creating graphics for inclusion rather than a stand-alone document) can be achieved by appending ‘landscape’ to the name of the paper size itself:

#(set-default-paper-size "a6landscape")

When the paper size ends with an explicit ‘landscape’ or ‘portrait’, the presence of a 'landscape symbol only affects print orientation, not the paper dimensions used for layout.

See also

Notation Reference: Automatic scaling to paper size, Predefined paper sizes.

Installed Files: ‘scm/paper.scm’.


Automatic scaling to paper size

If the paper size is changed with one of the scheme functions (set-default-paper-size or set-paper-size), the values of several \paper variables are automatically scaled to the new size. To bypass the automatic scaling for a particular variable, set the variable after setting the paper size. Note that the automatic scaling is not triggered by setting the paper-height or paper-width variables, even though paper-width can influence other values (this is separate from scaling and is discussed below). The set-default-paper-size and set-paper-size functions are described in Setting the paper size.

The vertical dimensions affected by automatic scaling are top-margin and bottom-margin (see Fixed vertical spacing \paper variables). The horizontal dimensions affected by automatic scaling are left-margin, right-margin, inner-margin, outer-margin, binding-offset, indent, and short-indent (see Horizontal spacing \paper variables).

The default values for these dimensions are set in ‘ly/paper-defaults-init.ly’, using internal variables named top-margin-default, bottom-margin-default, etc. These are the values that result at the default paper size a4. For reference, with a4 paper the paper-height is 297\mm and the paper-width is 210\mm.

See also

Notation Reference: Fixed vertical spacing \paper variables, Horizontal spacing \paper variables.

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


LilyPond — Notation Reference v2.24.4 (stable-branch).