version that you are working on. See TRANSLATION for details.
@end ignore
-@c A menu is needed before every deeper *section nesting of @node's; run
-@c M-x texinfo-all-menus-update
-@c to automatically fill in these menus before saving changes
+@c \version "2.11.51"
+
+@ignore
+GDP TODO list
+
+Negative numbers are allowed:
+> Are you sure? The following works well
+> \paper{
+> first-page-number = -2
+> }
+> and prints page number -1 on the second page, for example.
+
+
+- default paper size is A4.
+
+
+In 5.2.1 the @refbugs (line 495 in spacing.itely on master) it
+states:
+
+"@code{layout-set-staff-size} does not change the distance between
+the
+staff lines."
+
+Could we add a sentence:
+"Use instead the pair fontSize = #@var{N}
+ \override StaffSymbol #'staff-space = #(magstep
+@var{N})
+inside the Staff context to change the size of the font and the
+distance between
+staff lines accordingly."
+
+Actually I found, that the @internalsref{StaffSymbol} at line 481
+sends to an uncomplete
+documentation. The property staff-space is not explained here. I
+thought Y-extent might be of
+help, but it is in turn explained by x-space which again is
+missing from the list. Who has the
+knowledge to fix this?
+
+
+Clarify
+http://code.google.com/p/lilypond/issues/detail?id=68
+
+@end ignore
@node Spacing issues
@chapter Spacing issues
so that neither the horizontal nor the vertical spacing is too cramped
or stretched.
+Settings which influence layout may be placed in two blocks.
+The @code{\paper @{...@}} block is placed outside any
+@code{\score @{...@}} blocks and contains settings that
+relate to the entire document. The @code{\layout @{...@}}
+block is placed within a @code{\score @{...@}} block and
+contains settings for that particular score. If you have
+only one @code{\score @{...@}} block the two have the same
+effect. In general the commands shown in this chapter can
+be placed in either.
+
@menu
* Paper and pages::
-* Music layout::
-* Displaying spacing::
-* Breaks::
-* Vertical spacing::
-* Horizontal spacing::
+* Music layout::
+* Breaks::
+* Vertical spacing::
+* Horizontal spacing::
+* Fitting music onto fewer pages::
@end menu
@section Paper and pages
This section deals with the boundaries that define the area
-that music can be printed inside.
+within which music can be printed.
@menu
* Paper size::
To change the paper size, there are two commands,
@example
#(set-default-paper-size "a4")
+@end example
+@example
\paper @{
#(set-paper-size "a4")
@}
@code{a6}, @code{a5}, @code{a4}, @code{a3}, @code{legal}, @code{letter},
@code{11x17} (also known as tabloid).
+@c TODO Add new paper sizes -td
+
Extra sizes may be added by editing the definition for
@code{paper-alist} in the initialization file @file{scm/paper.scm}.
@funindex paper-width
@item paper-width
The width of the page. The default is taken from the current paper size,
-see @ref{Paper size}.
+see @ref{Paper size}.
@funindex paper-height
@item paper-height
The height of the page. The default is taken from the current paper size,
-see @ref{Paper size}.
+see @ref{Paper size}.
@funindex top-margin
@item top-margin
Margin between the left side of the page and the beginning of the
music. Unset by default, which means that the margins is determined
based on the @code{paper-width} and @code{line-width} to center the
-score on the paper.
+score on the paper.
@funindex line-width
@item line-width
@funindex head-separation
@item head-separation
Distance between the top-most music system and the page header. Default
-is@tie{}4mm.
+is@tie{}4mm.
@funindex foot-separation
@item foot-separation
@item auto-first-page-number
The page breaking algorithm is affected by the first page number being
odd or even. If this variable is set to #t, the page breaking algorithm
-will decide whether to start with an odd or even number. This will
+will decide whether to start with an odd or even number. This will
result in the first page number remaining as is or being increased by one.
@end table
@end quotation
-@commonprop
+@snippets
The header and footer are created by the functions make-footer and
make-header, defined in \paper. The default implementations are in
@}
@end example
-This second example centers page numbers at the bottom of every page.
+This second example centers page numbers at the bottom of every page.
@example
\paper @{
evenFooterMarkup = \markup @{ \fill-line @{
\bold \fontsize #3 \on-the-fly #print-page-number-check-first
\fromproperty #'page:page-number-string @} @}
-@}
+@}
@end example
You can also define these values in Scheme. In that case @code{mm},
page given the system to put on it.
-@refbugs
+@knownissues
The option right-margin is defined but doesn't set the right margin
yet. The value for the right margin has to be defined adjusting the
@section Music layout
@menu
-* Setting the staff size::
-* Score layout::
+* Setting the staff size::
+* Score layout::
@end menu
@cindex staff size, setting
@funindex layout file
+The default @strong{staff size} is set to 20 points.
+This may be changed in two ways:
+
To set the staff size globally for all scores in a file (or
in a @code{book} block, to be precise), use @code{set-global-staff-size}.
This sets the global default size to 14pt staff height and scales all
fonts accordingly.
-To set the staff size individually for each score, use
+To set the staff size individually for each score, use
@example
\score@{
...
These fonts are available in any sizes. The context property
@code{fontSize} and the layout property @code{staff-space} (in
-@internalsref{StaffSymbol}) can be used to tune the size for individual
+@rinternals{StaffSymbol}) can be used to tune the size for individual
staves. The sizes of individual staves are relative to the global size.
@example
This manual: @ref{Selecting notation font size}.
-@refbugs
+@knownissues
@code{layout-set-staff-size} does not change the distance between the
staff lines.
This manual: @ref{Changing context default settings}.
-@node Displaying spacing
-@section Displaying spacing
-
-@funindex annotate-spacing
-@cindex Spacing, display of properties
-
-To graphically display the dimensions of vertical properties that may
-be altered for page formatting, set @code{annotate-spacing} in the
-@code{\paper} block, like this
-
-
-@c need to have \book{} otherwise we get the separate systems. -hwn
-@lilypond[verbatim]
-#(set-default-paper-size "a6" 'landscape)
-
-\book {
- \score { { c4 } }
- \paper { annotate-spacing = ##t }
-}
-@end lilypond
-
-
-@c TODO: really bad vagueness due to bug in annotate-spacing. -gp
-@noindent
-Some unit dimensions are measured in staff spaces, while others
-are measured in millimeters.
-The pairs
-(@var{a},@var{b}) are intervals, where @var{a} is the lower edge and
-@var{b} the upper edge of the interval.
-
-
@node Breaks
@section Breaks
@menu
-* Line breaking::
-* Page breaking::
-* Optimal page breaking::
-* Optimal page turning::
-* Minimal page breaking::
-* Explicit breaks::
-* Using an extra voice for breaks::
+* Line breaking::
+* Page breaking::
+* Optimal page breaking::
+* Optimal page turning::
+* Minimal page breaking::
+* Explicit breaks::
+* Using an extra voice for breaks::
@end menu
@node Line breaking
@cindex line breaks
@cindex breaking lines
-Line breaks are normally computed automatically. They are chosen so
-that lines look neither cramped nor loose, and that consecutive lines
-have similar density.
+Line breaks are normally determined automatically. They are chosen
+so that lines look neither cramped nor loose, and consecutive
+lines have similar density. Occasionally you might want to
+override the automatic breaks; you can do this by specifying
+@code{\break}. This will force a line break at this point. However,
+line breaks can only occur at the end of @q{complete} bars, i.e.,
+where there are no notes or tuplets left @q{hanging} over the bar
+line. If you want to have a line break where there is no bar line,
+you can force an invisible bar line by entering @code{\bar ""},
+although again there must be no notes left hanging over in any of
+the staves at this point, or it will be ignored.
+
+The opposite command, @code{\noBreak}, forbids a line break at the
+bar line where it is inserted.
+
+The most basic settings influencing line spacing are @code{indent}
+and @code{line-width}. They are set in the @code{\layout} block.
+They control the indentation of the first line of music, and the
+lengths of the lines.
+
+If @code{ragged-right} is set to true in the @code{\layout} block,
+then systems end at their natural horizontal length, instead of
+being spread horizontally to fill the whole line. This is useful
+for short fragments, and for checking how tight the natural
+spacing is.
+
+@c TODO Check and add para on default for ragged-right
+
+The option @code{ragged-last} is similar to @code{ragged-right},
+but affects only the last line of the piece.
+
+@example
+\layout @{
+indent = #0
+line-width = #150
+ragged-last = ##t
+@}
+@end example
-Occasionally you might want to override the automatic breaks; you can
-do this by specifying @code{\break}. This will force a line break at
-this point. Line breaks can only occur at places where there are bar
-lines. If you want to have a line break where there is no bar line,
-you can force an invisible bar line by entering @code{\bar
-""}. Similarly, @code{\noBreak} forbids a line break at a
-point.
@cindex regular line breaks
@cindex four bar music.
For line breaks at regular intervals use @code{\break} separated by
-skips and repeated with @code{\repeat}:
+skips and repeated with @code{\repeat}. For example, this would
+cause the following 28 measures (assuming 4/4 time) to be broken
+every 4 measures, and only there:
+
@example
<< \repeat unfold 7 @{
s1 \noBreak s1 \noBreak
>>
@end example
-@noindent
-This makes the following 28 measures (assuming 4/4 time) be broken every
-4 measures, and only there.
-
-@refcommands
+@predefined
@code{\break}, and @code{\noBreak}.
@funindex \break
@seealso
-Internals: @internalsref{LineBreakEvent}.
+Internals: @rinternals{LineBreakEvent}.
+@c TODO Check this
A linebreaking configuration can be saved as a @code{.ly} file
automatically. This allows vertical alignments to be stretched to
fit pages in a second formatting run. This is fairly new and
complicated. More details are available in
-@c @lsrdir{spacing}
+@rlsr{Spacing}.
-@refbugs
+@knownissues
Line breaks can only occur if there is a @q{proper} bar line. A note
which is hanging over a bar line is not proper, such as
\remove Forbid_line_break_engraver
} {
c4 c2 << c2 {s4 \break } >> % now the break is allowed
- c2 c4
+ c2 c4
}
@end lilypond
Similarly, line breaks are normally forbidden when beams cross bar
-lines. This behavior can be changed by setting
+lines. This behavior can be changed by setting
@code{\override Beam #'breakable = ##t}.
@node Page breaking
@subsection Page breaking
-The default page breaking may be overriden by inserting
+The default page breaking may be overridden by inserting
@code{\pageBreak} or @code{\noPageBreak} commands. These commands are
analogous to @code{\break} and @code{\noBreak}. They should be
inserted at a bar line. These commands force and forbid a page-break
The @code{\pageBreak} and @code{\noPageBreak} commands may also be
inserted at top-level, between scores and top-level markups.
+There are also analogous settings to @code{ragged-right} and
+@code{ragged-last} which have the same effect on vertical spacing:
+@code{ragged-bottom} and @code{ragged-last-bottom}. If set to
+@code{##t} the systems on all pages or just the last page
+respectively will not be justified vertically.
+
+For more details see @ref{Vertical spacing}.
+
Page breaks are computed by the @code{page-breaking} function. LilyPond
provides three algorithms for computing page breaks,
@code{ly:optimal-breaking}, @code{ly:page-turn-breaking} and
@}
@end example
+@c TODO Check this -td
The old page breaking algorithm is called
@code{optimal-page-breaks}. If you are having trouble with the new page
breakers, you can enable the old one as a workaround.
-@refcommands
+@predefined
@funindex \pageBreak
@code{\pageBreak}
@code{\allowPageTurn}, may also be used at top-level, between scores and
top-level markups.
-@refcommands
+@predefined
@funindex \pageTurn
@code{\pageTurn}
@funindex \allowPageTurn
@code{\allowPageTurn}
-@refbugs
+@knownissues
There should only be one @code{Page_turn_engraver} in a score. If there is more
than one, they will interfere with each other.
The @code{ly:minimal-breaking} function performs minimal computations to
calculate the page breaking: it fills a page with as many systems as
-possible before moving to the next one. Thus, it may be prefered for
+possible before moving to the next one. Thus, it may be preferred for
scores with many pages, where the other page breaking functions could be
too slow or memory demanding, or a lot of texts. It is enabled using:
\override NonMusicalPaperColumn #'page-break-permission = ##f
@end example
-When @code{line-break-permission} is overriden to false, Lily will insert
+When @code{line-break-permission} is overridden to false, Lily will insert
line breaks at explicit @code{\break} commands and nowhere else. When
-@code{page-break-permission} is overriden to false, Lily will insert
+@code{page-break-permission} is overridden to false, Lily will insert
page breaks at explicit @code{\pageBreak} commands and nowhere else.
@lilypond[quote,verbatim]
Normally staves are stacked vertically. To make staves maintain a
distance, their vertical size is padded. This is done with the
property @code{minimum-Y-extent}. When applied to a
-@internalsref{VerticalAxisGroup}, it controls the size of a horizontal
+@rinternals{VerticalAxisGroup}, it controls the size of a horizontal
line, such as a staff or a line of lyrics. @code{minimum-Y-extent}
takes a pair of numbers, so
if you want to make it smaller than its default @code{#'(-4 . 4)}
system is reevaluated in order to fill the page more evenly; if a page
has space left over, systems are stretched in order to fill that space.
The amount of stretching can be configured though the @code{max-stretch}
-property of the @internalsref{VerticalAlignment} grob. By default,
+property of the @rinternals{VerticalAlignment} grob. By default,
@code{max-stretch} is set to zero, disabling stretching. To enable
stretching, a sane value for @code{max-stretch}
is @code{ly:align-interface::calc-max-stretch}.
middle of an orchestral score, you may want to leave the piano staves
close to each other while stretching the rest of the score. The
@code{keep-fixed-while-stretching} property of
-@internalsref{VerticalAxisGroup} can be used to achieve this. When set
+@rinternals{VerticalAxisGroup} can be used to achieve this. When set
to @code{##t}, this property keeps its staff (or line of lyrics) from
moving relative to the one directly above it. In the example above,
you would override @code{keep-fixed-while-stretching} to @code{##t} in
@seealso
Internals: Vertical alignment of staves is handled by the
-@internalsref{VerticalAlignment} object. The context parameters
+@rinternals{VerticalAlignment} object. The context parameters
specifying the vertical extent are described in connection with
-the @internalsref{Axis_group_engraver}.
+the @rinternals{Axis_group_engraver}.
Example files: @c @lsr{spacing,page-spacing.ly},
@c @lsr{spacing,alignment-vertical-spacing.ly}.
@end example
When only a couple of flat systems are placed on a page, the resulting
-vertical spacing may be non-eleguant: one system at the top of the page,
+vertical spacing may be non-elegant: one system at the top of the page,
and the other at the bottom, with a huge gap between them. To avoid this
situation, the space added between the systems can be limited. This
feature is activated by setting to @code{#t} the
The @code{ragged-bottom} property adds space between systems, while
the two-pass technique adds space between staves inside a system.
-To allow this behaviour, a @code{tweak-key} variable has to be set in
+To allow this behavior, a @code{tweak-key} variable has to be set in
each score @code{\layout} block, and the tweaks included in each score
music, using the @code{\scoreTweak} music function.
\once \override TextScript #'outside-staff-priority = #1
c4_"Text"\pp % this time the text will be closer to the staff
r2.
-% by setting outside-staff-priority to a non-number, we
-% disable the automatic collision avoidance
+% by setting outside-staff-priority to a non-number,
+% we disable the automatic collision avoidance
\once \override TextScript #'outside-staff-priority = ##f
\once \override DynamicLineSpanner #'outside-staff-priority = ##f
c4_"Text"\pp % now they will collide
TODO: this example doesn't work any more ?
By default, outside-staff objects are placed without regard to
-their horizontal distance from the previously-posititioned grobs. This
+their horizontal distance from the previously-positioned grobs. This
can lead to situations in which objects are placed very close to each
other horizontally. Setting @code{outside-staff-horizontal-padding}
causes an object to be offset vertically so that such a situation
@subsection Horizontal spacing overview
The spacing engine translates differences in durations into stretchable
-distances (@q{springs}) of differring lengths. Longer durations get
+distances (@q{springs}) of differing lengths. Longer durations get
more space, shorter durations get less. The shortest durations get a
fixed amount of space (which is controlled by
-@code{shortest-duration-space} in the @internalsref{SpacingSpanner}
+@code{shortest-duration-space} in the @rinternals{SpacingSpanner}
object). The longer the duration, the more space it gets: doubling a
duration adds a fixed amount (this amount is controlled by
@code{spacing-increment}) of space to the note.
@code{lilypond} with the @code{--verbose} option.
These durations may also be customized. If you set the
-@code{common-shortest-duration} in @internalsref{SpacingSpanner}, then
+@code{common-shortest-duration} in @rinternals{SpacingSpanner}, then
this sets the base duration for spacing. The maximum duration for this
base (normally an 8th), is set through @code{base-shortest-duration}.
In the introduction (see @rlearning{Engraving}), it was explained that stem
directions influence spacing. This is controlled with the
@code{stem-spacing-correction} property in the
-@internalsref{NoteSpacing}, object. These are generated for every
-@internalsref{Voice} context. The @code{StaffSpacing} object
-(generated in @internalsref{Staff} context) contains the same property
+@rinternals{NoteSpacing}, object. These are generated for every
+@rinternals{Voice} context. The @code{StaffSpacing} object
+(generated in @rinternals{Staff} context) contains the same property
for controlling the stem/bar line spacing. The following example shows
these corrections, once with default settings, and once with
exaggerated corrections:
@seealso
-Internals: @internalsref{SpacingSpanner}, @internalsref{NoteSpacing},
-@internalsref{StaffSpacing}, @internalsref{SeparationItem}, and
-@internalsref{SeparatingGroupSpanner}.
+Internals: @rinternals{SpacingSpanner}, @rinternals{NoteSpacing},
+@rinternals{StaffSpacing}, and @rinternals{SeparationItem}.
-@refbugs
+@knownissues
There is no convenient mechanism to manually override spacing. The
following work-around may be used to insert extra space into a score.
The @code{\newSpacingSection} command creates a new
-@internalsref{SpacingSpanner} object, and hence new @code{\override}s
+@rinternals{SpacingSpanner} object, and hence new @code{\override}s
may be used in that location.
a duration, so @code{1 4} is a longer duration
than @code{1 16}.
-@lilypond[relative,verbatim,line-width=12\cm]
+@lilypond[verbatim,line-width=12\cm]
\score {
\relative c'' {
g4 e e2 | f4 d d2 | c4 d e f | g4 g g2 |
}
@end lilypond
-@lilypond[relative,verbatim,line-width=12\cm]
+@lilypond[verbatim,line-width=12\cm]
\score {
\relative c'' {
g4 e e2 | f4 d d2 | c4 d e f | g4 g g2 |
@end lilypond
-@commonprop
+@snippets
By default, spacing in tuplets depends on various non-duration
factors (such as accidentals, clef changes, etc). To disregard
equivalent to its rhythmic duration. This type of proportional spacing
is comparable to horizontal spacing on top of graph paper. Some late
20th- and early 21st-century scores use proportional notation to
-clarify complex rhythmic relationships or to faciliate the placement
+clarify complex rhythmic relationships or to facilitate the placement
of timelines or other graphics directly in the score.
LilyPond supports five different settings for proportional notation,
lives in @code{Score}. Recall that context settings appear in one of
three locations in our input file -- in a @code{\with} block, in a
@code{\context} block, or directly in music entry
-preceeded by the @code{\set} command. As with all
+preceded by the @code{\set} command. As with all
context settings, users can pick which of the three different
locations they would like to set @code{proportionalNotationDuration}.
@end lilypond
Nonmusical elements like time signatures, key signatures, clefs and
-accidentals are problemmatic in proportional notation. None of these
+accidentals are problematic in proportional notation. None of these
elements has rhythmic duration. But all of these elements consume
horizontal space. Different proportional scores approach these
problems differently.
for these related settings.
+@node Fitting music onto fewer pages
+@section Fitting music onto fewer pages
+
+Sometimes you can end up with one or two staves on a second
+(or third, or fourth...) page. This is annoying, especially
+if you look at previous pages and it looks like there is plenty
+of room left on those.
+
+When investigating layout issues, @code{annotate-spacing} is an
+invaluable tool. This command prints the values of various layout
+spacing variables; for more details see the following section,
+@ref{Displaying spacing}.
+
+@menu
+* Displaying spacing::
+* Changing spacing::
+@end menu
+
+
+@node Displaying spacing
+@subsection Displaying spacing
+
+@funindex annotate-spacing
+@cindex spacing, display of layout
+
+To graphically display the dimensions of vertical layout variables
+that may be altered for page formatting, set
+@code{annotate-spacing} in the @code{\paper} block:
+
+@c need to have \book{} otherwise we get the separate systems. -hwn
+@lilypond[verbatim,quote]
+#(set-default-paper-size "a6" 'landscape)
+\book {
+ \score { { c4 } }
+ \paper { annotate-spacing = ##t }
+}
+@end lilypond
+
+@noindent
+All layout dimensions are displayed in staff spaces, regardless of
+the units specified in the @code{\paper} or @code{\layout} block.
+For example, @code{paper-height} has a value of 59.75 staff
+spaces, using the default staff size of 20 points, which is
+equivalent to 148 millimeters, the height of @code{a6} paper in
+landscape orientation. The pairs (@var{a},@var{b}) are intervals,
+where @var{a} is the lower edge and @var{b} the upper edge of the
+interval.
+
+
+@node Changing spacing
+@subsection Changing spacing
+
+The output of @code{annotate-spacing} reveals vertical dimensions
+in great detail. For details about modifying margins and other
+layout variables, see @ref{Page formatting}.
+
+Other than margins, there are a few other options to save space:
+
+@itemize
+@item
+Force systems to move as close together as possible (to fit as
+many systems as possible onto a page) while being spaced so that
+there is no blank space at the bottom of the page.
+
+@example
+\paper @{
+ between-system-padding = #0.1
+ between-system-space = #0.1
+ ragged-last-bottom = ##f
+ ragged-bottom = ##f
+@}
+@end example
+
+@item
+Force the number of systems. For example, if the default layout
+has 11 systems, the following assignment will force a layout with
+10 systems.
+
+@example
+\paper @{
+ system-count = #10
+@}
+@end example
+
+@item
+Avoid (or reduce) objects that increase the vertical size of a
+system. For example, volta repeats (or alternate repeats) require
+extra space. If these repeats are spread over two systems, they
+will take up more space than one system with the volta repeats and
+another system without. For example, dynamics that @q{stick out} of
+a system can be moved closer to the staff:
+
+@lilypond[verbatim,quote,relative=1]
+e4 c g\f c
+\override DynamicText #'extra-offset = #'( -2.2 . 2.0)
+e4 c g\f c
+@end lilypond
+
+@item
+Alter the horizontal spacing via @code{SpacingSpanner}. For more
+details, see @ref{Changing horizontal spacing}. The following
+example illustrates the default spacing:
+
+@lilypond[verbatim,quote]
+\score {
+ \relative c'' {
+ g4 e e2 |
+ f4 d d2 |
+ c4 d e f |
+ g4 g g2 |
+ g4 e e2 |
+ }
+}
+@end lilypond
+
+@noindent
+The next example modifies @code{common-shortest-duration} from a
+value of @code{1/4} to @code{1/2}. The quarter note is the most
+common and shortest duration in this example, so by making this
+duration longer, a @q{squeezing} effect occurs:
+
+@lilypond[verbatim,quote]
+\score {
+ \relative c'' {
+ g4 e e2 |
+ f4 d d2 |
+ c4 d e f |
+ g4 g g2 |
+ g4 e e2 |
+ }
+ \layout {
+ \context {
+ \Score
+ \override SpacingSpanner
+ #'common-shortest-duration = #(ly:make-moment 1 2)
+ }
+ }
+}
+@end lilypond
+
+@noindent
+The @code{common-shortest-duration} property cannot be modified
+dynamically, so it must always be placed in a @code{\context}
+block so that it applies to the whole score.
+
+@end itemize
+
+
+@seealso
+
+Notation Reference:
+@ref{Page formatting},
+@ref{Changing horizontal spacing}.