1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
4 @c A menu is needed before every deeper *section nesting of @node's; run
5 @c M-x texinfo-all-menus-update
6 @c to automatically fill in these menus before saving changes
9 @chapter Spacing issues
11 The global paper layout is determined by three factors: the page layout, the
12 line breaks, and the spacing. These all influence each other. The
13 choice of spacing determines how densely each system of music is set.
14 This influences where line breaks are chosen, and thus ultimately, how
15 many pages a piece of music takes.
17 Globally speaking, this procedure happens in four steps: first,
18 flexible distances (``springs'') are chosen, based on durations. All
19 possible line breaking combinations are tried, and a ``badness'' score
20 is calculated for each. Then the height of each possible system is
21 estimated. Finally, a page breaking and line breaking combination is chosen
22 so that neither the horizontal nor the vertical spacing is too cramped
29 * Horizontal spacing::
31 * Displaying spacing::
36 @section Paper and pages
38 This section deals with the boundaries that define the area
39 that music can be printed inside.
48 @subsection Paper size
54 To change the paper size, there are two commands,
56 #(set-default-paper-size "a4")
58 #(set-paper-size "a4")
62 The first command sets the size of all pages. The second command sets the
64 of the pages that the @code{\paper} block applies to -- if the @code{\paper}
65 block is at the top of the file, then it will apply to all pages. If the
66 @code{\paper} block is inside a @code{\book}, then the paper size will only
69 Support for the following paper sizes are included by default,
70 @code{a6}, @code{a5}, @code{a4}, @code{a3}, @code{legal}, @code{letter},
71 @code{11x17} (also known as tabloid).
73 Extra sizes may be added by editing the definition for
74 @code{paper-alist} in the initialization file @file{scm/paper.scm}.
79 If the symbol @code{landscape} is supplied as an argument to
80 @code{set-default-paper-size}, the pages will be rotated by 90 degrees,
81 and wider line widths will be set correspondingly.
84 #(set-default-paper-size "a6" 'landscape)
87 Setting the paper size will adjust a number of @code{\paper} variables
88 (such as margins). To use a particular paper size with altered
89 @code{\paper} variables, set the paper size before setting the variables.
93 @subsection Page formatting
95 @cindex page formatting
100 LilyPond will do page layout, set margins, and add headers and
101 footers to each page.
103 The default layout responds to the following settings in the
110 @funindex first-page-number
111 @item first-page-number
112 The value of the page number of the first page. Default is@tie{}1.
114 @funindex printfirst-page-number
115 @item print-first-page-number
116 If set to true, will print the page number in the first page. Default is
119 @funindex print-page-number
120 @item print-page-number
121 If set to false, page numbers will not be printed. Default is true.
123 @funindex paper-width
125 The width of the page. The default is taken from the current paper size,
126 see @ref{Paper size}.
128 @funindex paper-height
130 The height of the page. The default is taken from the current paper size,
131 see @ref{Paper size}.
135 Margin between header and top of the page. Default is@tie{}5mm.
137 @funindex bottom-margin
139 Margin between footer and bottom of the page. Default is@tie{}6mm.
141 @funindex left-margin
143 Margin between the left side of the page and the beginning of the
144 music. Unset by default, which means that the margins is determined
145 based on the @code{paper-width} and @code{line-width} to center the
150 The length of the systems. Default is @code{paper-width} minus @tie{}20mm.
152 @funindex head-separation
153 @item head-separation
154 Distance between the top-most music system and the page header. Default
157 @funindex foot-separation
158 @item foot-separation
159 Distance between the bottom-most music system and the page
160 footer. Default is@tie{}4mm.
162 @funindex page-top-space
163 Distance from the top of the printable area to the center of the first
164 staff. This only works for staves which are vertically small. Big staves
165 are set with the top of their bounding box aligned to the top of the
166 printable area. Default is@tie{}12mm.
168 @funindex ragged-bottom
170 If set to true, systems will not be spread vertically across the page. This
171 does not affect the last page. Default is false.
173 This should be set to true for pieces that have only two or three
174 systems per page, for example orchestral scores.
176 @funindex ragged-last-bottom
177 @item ragged-last-bottom
178 If set to false, systems will be spread vertically to fill the last
179 page. Default is true.
181 Pieces that amply fill two pages or more should have this set to
184 @funindex system-count
186 This variable, if set, specifies into how many lines a score should be
187 broken. Unset by default.
189 @funindex between-system-space
190 @item between-system-space
191 This dimensions determines the distance between systems. It is the
192 ideal distance between the center of the bottom staff of one system
193 and the center of the top staff of the next system. Default is@tie{}20mm.
195 Increasing this will provide a more even appearance of the page at the
196 cost of using more vertical space.
198 @funindex between-system-padding
199 @item between-system-padding
200 This dimension is the minimum amount of white space that will always
201 be present between the bottom-most symbol of one system, and the
202 top-most of the next system. Default is@tie{}4mm.
204 Increasing this will put systems whose bounding boxes almost touch
208 @funindex horizontal-shift
209 @item horizontal-shift
210 All systems (including titles and system separators) are shifted by
211 this amount to the right. Page markup, such as headers and footers are
212 not affected by this. The purpose of this variable is to make space
213 for instrument names at the left. Default is@tie{}0.
215 @funindex after-title-space
216 @item after-title-space
217 Amount of space between the title and the first system. Default is@tie{}5mm.
219 @funindex before-title-space
220 @item before-title-space
221 Amount of space between the last system of the previous piece and the
222 title of the next. Default is@tie{}10mm.
224 @funindex between-title-space
225 @item between-title-space
226 Amount of space between consecutive titles (e.g., the title of the
227 book and the title of a piece). Default is@tie{}2mm.
229 @funindex printallheaders
230 @item printallheaders
231 Setting this to #t will print all headers for each \score in a
232 \book. Normally only the piece and opus \headers are printed.
234 @funindex systemSeparatorMarkup
235 @item systemSeparatorMarkup
236 This contains a markup object, which will be inserted between
237 systems. This is often used for orchestral scores. Unset by default.
239 The markup command @code{\slashSeparator} is provided as a sensible
242 @lilypond[ragged-right]
245 \relative { c1 \break c1 }
248 systemSeparatorMarkup = \slashSeparator
253 @funindex blank-page-force
254 @item blank-page-force
255 The penalty for having a blank page in the middle of a
256 score. This is not used by @code{ly:optimal-breaking} since it will
257 never consider blank pages in the middle of a score. Default value
260 @funindex blank-last-page-force
261 @item blank-last-page-force
262 The penalty for ending the score on an odd-numbered page.
265 @funindex page-spacing-weight
266 @item page-spacing-weight
267 The relative importance of page (vertical) spacing and line (horizontal)
268 spacing. High values will make page spacing more important. Default
271 @funindex auto-first-page-number
272 @item auto-first-page-number
273 The page breaking algorithm is affected by the first page number being
274 odd or even. If this variable is set to #t, the page breaking algorithm
275 will decide whether to start with an odd or even number. This will
276 result in the first page number remaining as is or being increased by one.
288 ragged-last-bottom = ##t
292 You can also define these values in Scheme. In that case @code{mm},
293 @code{in}, @code{pt}, and @code{cm} are variables defined in
294 @file{paper-defaults.ly} with values in millimeters. That is why the
295 value must be multiplied in the example
299 #(define bottom-margin (* 2 cm))
303 The header and footer are created by the functions @code{make-footer}
304 and @code{make-header}, defined in @code{\paper}. The default
305 implementations are in @file{ly/@/paper@/-defaults@/.ly} and
306 @file{ly/@/titling@/-init@/.ly}.
308 The page layout itself is done by two functions in the
309 @code{\paper} block, @code{page-music-height} and
310 @code{page-make-stencil}. The former tells the line-breaking algorithm
311 how much space can be spent on a page, the latter creates the actual
312 page given the system to put on it.
317 The option right-margin is defined but doesn't set the right margin
318 yet. The value for the right margin has to be defined adjusting the
319 values of @code{left-margin} and @code{line-width}.
321 The default page header puts the page number and the @code{instrument}
322 field from the @code{\header} block on a line.
324 The titles (from the @code{\header@{@}} section) are treated as a
325 system, so @code{ragged-bottom} and @code{ragged-last-bottom} will
326 add space between the titles and the first system of the score.
330 @section Music layout
333 * Setting global staff size::
338 @node Setting global staff size
339 @subsection Setting global staff size
341 @cindex font size, setting
342 @cindex staff size, setting
343 @funindex layout file
345 To set the global staff size, use @code{set-global-staff-size}.
348 #(set-global-staff-size 14)
352 This sets the global default size to 14pt staff height and scales all
355 The Feta font provides musical symbols at eight different
356 sizes. Each font is tuned for a different staff size: at a smaller size
357 the font becomes heavier, to match the relatively heavier staff lines.
358 The recommended font sizes are listed in the following table:
361 @multitable @columnfractions .15 .2 .22 .2
364 @tab @b{staff height (pt)}
365 @tab @b{staff height (mm)}
407 @c modern rental material?
412 These fonts are available in any sizes. The context property
413 @code{fontSize} and the layout property @code{staff-space} (in
414 @internalsref{StaffSymbol}) can be used to tune the size for individual
415 staves. The sizes of individual staves are relative to the global size.
423 This manual: @ref{Selecting notation font size}.
427 @subsection Score layout
431 While @code{\paper} contains settings that relate to the page formatting
432 of the whole document, @code{\layout} contains settings for score-specific
439 \override VerticalAxisGroup #'minimum-Y-extent = #'(-6 . 6)
442 \override TextScript #'padding = #1.0
443 \override Glissando #'thickness = #3
451 This manual: @ref{Changing context default settings}
454 @node Vertical spacing
455 @section Vertical spacing
457 @cindex vertical spacing
458 @cindex spacing, vertical
460 Vertical spacing is controlled by three things: the amount of
461 space available (i.e., paper size and margins), the amount of
462 space between systems, and the amount of space between
463 staves inside a system.
466 * Vertical spacing inside a system::
467 * Vertical spacing of piano staves::
468 * Vertical spacing between systems::
469 * Controlling spacing of individual systems::
473 @node Vertical spacing inside a system
474 @subsection Vertical spacing inside a system
476 @cindex distance between staves
477 @cindex staff distance
478 @cindex space between staves
479 @cindex space inside systems
481 The height of each system is determined automatically. To prevent
482 staves from bumping into each other, some minimum distances are set.
483 By changing these, you can put staves closer together. This
484 reduces the amount of space each system requires, and may result
485 in having more systems per page.
487 Normally staves are stacked vertically. To make staves maintain a
488 distance, their vertical size is padded. This is done with the
489 property @code{minimum-Y-extent}. When applied to a
490 @internalsref{VerticalAxisGroup}, it controls the size of a horizontal
491 line, such as a staff or a line of lyrics. @code{minimum-Y-extent}
492 takes a pair of numbers, so
493 if you want to make it smaller than its default @code{#'(-4 . 4)}
497 \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)
501 This sets the vertical size of the current staff to 3 staff spaces on
502 either side of the center staff line. The value @code{(-3 . 3)} is
503 interpreted as an interval, where the center line is the 0, so the
504 first number is generally negative. The numbers need not match;
505 for example, the staff can be made larger at the bottom by setting
506 it to @code{(-6 . 4)}.
511 Internals: Vertical alignment of staves is handled by the
512 @internalsref{VerticalAlignment} object. The context parameters
513 specifying the vertical extent are described in connection with
514 the @internalsref{Axis_group_engraver}.
516 Example files: @inputfileref{input/regression/,page-spacing.ly},
517 @inputfileref{input/regression/,alignment-vertical-spacing.ly}.
520 @node Vertical spacing of piano staves
521 @subsection Vertical spacing of piano staves
523 The distance between staves of a @internalsref{PianoStaff} cannot be
524 computed during formatting. Rather, to make cross-staff beaming work
525 correctly, that distance has to be fixed beforehand.
527 The distance of staves in a @code{PianoStaff} is set with the
528 @code{forced-distance} property of the
529 @internalsref{VerticalAlignment} object, created in
530 @internalsref{PianoStaff}.
532 It can be adjusted as follows
534 \new PianoStaff \with @{
535 \override VerticalAlignment #'forced-distance = #7
542 This would bring the staves together at a distance of 7 staff spaces,
543 measured from the center line of each staff.
545 The difference is demonstrated in the following example,
546 @lilypond[quote,verbatim]
548 \new PianoStaff \with {
549 \override VerticalAlignment #'forced-distance = #7
564 Example files: @inputfileref{input/regression/,alignment-vertical-spacing.ly}.
567 @node Vertical spacing between systems
568 @subsection Vertical spacing between systems
570 Space between systems are controlled by four @code{\paper} variables,
574 between-system-space = 1.5\cm
575 between-system-padding = #1
577 ragged-last-bottom=##f
582 @node Controlling spacing of individual systems
583 @subsection Controlling spacing of individual systems
585 It is also possible to change the distance between for each system
586 individually. This is done by including the command
590 #"Score.NonMusicalPaperColumn"
591 #'line-break-system-details
592 #'((fixed-alignment-extra-space . 15))
596 at the line break before the system to be changed. The distance
597 @code{15} is distributed over all staves that have a fixed distance
598 alignment. For example,
600 @lilypond[ragged-right, fragment, relative=2, staffsize=13]
606 #"Score.NonMusicalPaperColumn"
607 #'line-break-system-details
608 #'((fixed-alignment-extra-space . 15))
616 The distance for @code{fixed-alignment-extra-space} may also be
621 @node Horizontal spacing
622 @section Horizontal Spacing
624 @cindex horizontal spacing
625 @cindex spacing, horizontal
628 * Horizontal spacing overview::
630 * Changing horizontal spacing::
635 @node Horizontal spacing overview
636 @subsection Horizontal spacing overview
638 The spacing engine translates differences in durations into stretchable
639 distances (``springs'') of differring lengths. Longer durations get
640 more space, shorter durations get less. The shortest durations get a
641 fixed amount of space (which is controlled by
642 @code{shortest-duration-space} in the @internalsref{SpacingSpanner}
643 object). The longer the duration, the more space it gets: doubling a
644 duration adds a fixed amount (this amount is controlled by
645 @code{spacing-increment}) of space to the note.
647 For example, the following piece contains lots of half, quarter, and
648 8th notes; the eighth note is followed by 1 note head width (NHW).
649 The quarter note is followed by 2 NHW, the half by 3 NHW, etc.
651 @lilypond[quote,fragment,verbatim,relative=1]
652 c2 c4. c8 c4. c8 c4. c8 c8
656 Normally, @code{spacing-increment} is set to 1.2 staff space, which is
657 approximately the width of a note head, and
658 @code{shortest-duration-space} is set to 2.0, meaning that the
659 shortest note gets 2.4 staff space (2.0 times the
660 @code{spacing-increment}) of horizontal space. This space is counted
661 from the left edge of the symbol, so the shortest notes are generally
662 followed by one NHW of space.
664 If one would follow the above procedure exactly, then adding a single
665 32nd note to a score that uses 8th and 16th notes, would widen up the
666 entire score a lot. The shortest note is no longer a 16th, but a 32nd,
667 thus adding 1 NHW to every note. To prevent this, the shortest
668 duration for spacing is not the shortest note in the score, but rather
669 the one which occurs most frequently.
672 The most common shortest duration is determined as follows: in every
673 measure, the shortest duration is determined. The most common shortest
674 duration is taken as the basis for the spacing, with the stipulation
675 that this shortest duration should always be equal to or shorter than
676 an 8th note. The shortest duration is printed when you run
677 @code{lilypond} with the @code{--verbose} option.
679 These durations may also be customized. If you set the
680 @code{common-shortest-duration} in @internalsref{SpacingSpanner}, then
681 this sets the base duration for spacing. The maximum duration for this
682 base (normally an 8th), is set through @code{base-shortest-duration}.
684 @funindex common-shortest-duration
685 @funindex base-shortest-duration
686 @funindex stem-spacing-correction
689 Notes that are even shorter than the common shortest note are
690 followed by a space that is proportional to their duration relative to
691 the common shortest note. So if we were to add only a few 16th notes
692 to the example above, they would be followed by half a NHW:
694 @lilypond[quote,fragment,verbatim,relative=2]
695 c2 c4. c8 c4. c16[ c] c4. c8 c8 c8 c4 c4 c4
699 In the introduction (see @ref{Engraving}), it was explained that stem
700 directions influence spacing. This is controlled with the
701 @code{stem-spacing-correction} property in the
702 @internalsref{NoteSpacing}, object. These are generated for every
703 @internalsref{Voice} context. The @code{StaffSpacing} object
704 (generated in @internalsref{Staff} context) contains the same property
705 for controlling the stem/bar line spacing. The following example shows
706 these corrections, once with default settings, and once with
707 exaggerated corrections:
709 @lilypond[quote,ragged-right]
713 \override Staff.NoteSpacing #'stem-spacing-correction = #1.5
714 \override Staff.StaffSpacing #'stem-spacing-correction = #1.5
720 Proportional notation is supported; see @ref{Proportional notation}.
725 Internals: @internalsref{SpacingSpanner}, @internalsref{NoteSpacing},
726 @internalsref{StaffSpacing}, @internalsref{SeparationItem}, and
727 @internalsref{SeparatingGroupSpanner}.
732 There is no convenient mechanism to manually override spacing. The
733 following work-around may be used to insert extra space into a score.
735 \once \override Score.SeparationItem #'padding = #1
738 No work-around exists for decreasing the amount of space.
741 @node New spacing area
742 @subsection New spacing area
744 New sections with different spacing parameters can be started with
745 @code{newSpacingSection}. This is useful when there are
746 sections with a different notions of long and short notes.
748 In the following example, the time signature change introduces a new
749 section, and hence the 16ths notes are spaced wider.
751 @lilypond[relative,fragment,verbatim,quote]
754 c8 c c4 c16[ c c8] c4
761 @node Changing horizontal spacing
762 @subsection Changing horizontal spacing
764 Horizontal spacing may be altered with the
765 @code{base-shortest-duration} property. Here
766 we compare the same music; once without altering
767 the property, and then altered. Larger values
768 of @code{ly:make-moment} will produce smaller
771 @lilypond[relative,verbatim,line-width=12\cm]
774 g4 e e2 | f4 d d2 | c4 d e f | g4 g g2 |
775 g4 e e2 | f4 d d2 | c4 e g g | c,1 |
776 d4 d d d | d4 e f2 | e4 e e e | e4 f g2 |
777 g4 e e2 | f4 d d2 | c4 e g g | c,1 |
782 @lilypond[relative,verbatim,line-width=12\cm]
785 g4 e e2 | f4 d d2 | c4 d e f | g4 g g2 |
786 g4 e e2 | f4 d d2 | c4 e g g | c,1 |
787 d4 d d d | d4 e f2 | e4 e e e | e4 f g2 |
788 g4 e e2 | f4 d d2 | c4 e g g | c,1 |
793 \override SpacingSpanner
794 #'base-shortest-duration = #(ly:make-moment 1 4)
803 By default, spacing in tuplets depends on various non-duration
804 factors (such as accidentals, clef changes, etc). To disregard
805 such symbols and force uniform equal-duration spacing, use
806 @code{Score.SpacingSpanner #'uniform-stretching}. This
807 property can only be changed at the beginning of a score,
809 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
811 \override SpacingSpanner #'uniform-stretching = ##t
829 When @code{strict-note-spacing} is set, notes are spaced without
830 regard for clefs, bar lines, and grace notes,
832 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
833 \override Score.SpacingSpanner #'strict-note-spacing = ##t
834 \new Staff { c8[ c \clef alto c \grace { c16[ c] } c8 c c] c32[ c32] }
839 @subsection Line length
842 @cindex breaking pages
846 @funindex ragged-right
847 @funindex ragged-last
849 @c Although line-width can be set in \layout, it should be set in paper
850 @c block, to get page layout right.
851 @c Setting indent in \paper block makes not much sense, but it works.
853 @c Bit verbose and vague, use examples?
854 The most basic settings influencing the spacing are @code{indent} and
855 @code{line-width}. They are set in the @code{\layout} block. They
856 control the indentation of the first line of music, and the lengths of
859 If @code{ragged-right} is set to true in the @code{\layout} block, then
860 systems ends at their natural horizontal length, instead of being spread
861 horizontally to fill the whole line. This is useful for
862 short fragments, and for checking how tight the natural spacing is.
865 @cindex vertical spacing
867 The option @code{ragged-last} is similar to @code{ragged-right}, but
868 only affects the last line of the piece. No restrictions are put on
869 that line. The result is similar to formatting text paragraphs. In a
870 paragraph, the last line simply takes its natural horizontal length.
871 @c Note that for text there are several options for the last line.
872 @c While Knuth TeX uses natural length, lead typesetters use the same
873 @c stretch as the previous line. eTeX uses \lastlinefit to
874 @c interpolate between both these solutions.
891 * Optimal page breaking::
892 * Optimal page turning::
896 @subsection Line breaking
899 @cindex breaking lines
901 Line breaks are normally computed automatically. They are chosen so
902 that lines look neither cramped nor loose, and that consecutive lines
903 have similar density.
905 Occasionally you might want to override the automatic breaks; you can
906 do this by specifying @code{\break}. This will force a line break at
907 this point. Line breaks can only occur at places where there are bar
908 lines. If you want to have a line break where there is no bar line,
909 you can force an invisible bar line by entering @code{\bar
910 ""}. Similarly, @code{\noBreak} forbids a line break at a
914 @cindex regular line breaks
915 @cindex four bar music.
917 For line breaks at regular intervals use @code{\break} separated by
918 skips and repeated with @code{\repeat}:
920 << \repeat unfold 7 @{
921 s1 \noBreak s1 \noBreak
922 s1 \noBreak s1 \break @}
923 @emph{the real music}
928 This makes the following 28 measures (assuming 4/4 time) be broken every
929 4 measures, and only there.
933 @code{\break}, and @code{\noBreak}.
939 Internals: @internalsref{LineBreakEvent}.
941 A linebreaking configuration can now be saved as a @code{.ly} file
942 automatically. This allows vertical alignments to be stretched to
943 fit pages in a second formatting run. This is fairly new and
944 complicated; see @inputfileref{input/regression/,page-layout-twopass.ly}
949 Line breaks can only occur if there is a ``proper'' bar line. A note
950 which is hanging over a bar line is not proper, such as
952 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
953 c4 c2 c2 \break % this does nothing
954 c2 c4 | % a break here would work
955 c4 c2 c4 ~ \break % as does this break
961 @subsection Page breaking
963 The default page breaking may be overriden by inserting
964 @code{\pageBreak} or @code{\noPageBreak} commands. These commands are
965 analogous to @code{\break} and @code{\noBreak}. They should be
966 inserted at a bar line. These commands force and forbid a page-break
967 from happening. Of course, the @code{\pageBreak} command also forces
970 Page breaks are computed by the @code{page-breaking} function.
971 LilyPond provides two algorithms for computing page
972 breaks, @code{ly:optimal-breaking} and @code{ly:page-turn-breaking}. The
973 default is @code{ly:optimal-breaking}, but the value can be changed in
974 the @code{\paper} block:
978 #(define page-breaking ly:page-turn-breaking)
982 The old page breaking algorithm is called
983 @code{optimal-page-breaks}. If you are having trouble with the new page
984 breakers, you can enable the old one as a workaround.
990 @funindex \noPageBreak
994 @node Optimal page breaking
995 @subsection Optimal page breaking
997 @funindex ly:optimal-breaking
999 The @code{ly:optimal-breaking} function is LilyPond's default method of
1000 determining page breaks. It attempts to find a page breaking that minimizes
1001 cramping and stretching, both horizontally and vertically. Unlike
1002 @code{ly:page-turn-breaking}, it has no concept of page turns.
1005 @node Optimal page turning
1006 @subsection Optimal page turning
1008 @funindex ly:page-turn-breaking
1010 Often it is necessary to find a page breaking configuration so that there is
1011 a rest at the end of every second page. This way, the musician can turn the
1012 page without having to miss notes. The @code{ly:page-turn-breaking} function
1013 attempts to find a page breaking minimizing cramping and stretching, but with
1014 the additional restriction that it is only allowed to introduce page turns
1015 in specified places.
1017 There are two steps to using this page breaking function. First, you must
1018 enable it in the @code{\paper} block. Then, you must tell the function
1019 where you would like to allow page breaks.
1021 There are two ways to achieve the second step. First, you can specify each
1022 potential page turn manually, by inserting @code{\allowPageTurn} into your
1023 input file at the appropriate places.
1025 If this is too tedious, you can add a @code{Page_turn_engraver} to a Staff or
1026 Voice context. The @code{Page_turn_engraver} will scan the context for
1027 sections without notes (note that it does not scan for rests; it scans for
1028 the absence of notes. This is so that single-staff polyphony with rests in one
1029 of the parts does not throw off the @code{Page_turn_engraver}). When it finds
1030 a sufficiently long section without notes, the @code{Page_turn_engraver} will
1031 insert an @code{\allowPageTurn} at the final barline in that section, unless
1032 there is a ``special'' barline (such as a double bar), in which case the
1033 @code{\allowPageTurn} will be inserted at the final ``special'' barline in
1036 @funindex minimumPageTurnLength
1037 The @code{Page_turn_engraver} reads the context property
1038 @code{minimumPageTurnLength} to determine how long a note-free section must
1039 be before a page turn is considered. The default value for
1040 @code{minimumPageTurnLength} is @code{#(ly:make-moment 1 1)}. If you want
1041 to disable page turns, you can set it to something very large.
1044 \new Staff \with @{ \consists "Page_turn_engraver" @}
1047 R1 | % a page turn will be allowed here
1049 \set Staff.minimumPageTurnLength = #(ly:make-moment 5 2)
1050 R1 | % a page turn will not be allowed here
1052 R1*2 | % a page turn will be allowed here
1057 @funindex minimumRepeatLengthForPageTurn
1058 The @code{Page_turn_engraver} detects volta repeats. It will only allow a page
1059 turn during the repeat if there is enough time at the beginning and end of the
1060 repeat to turn the page back. The @code{Page_turn_engraver} can also disable
1061 page turns if the repeat is very short. If you set the context property
1062 @code{minimumRepeatLengthForPageTurn} then the @code{Page_turn_engraver} will
1063 only allow turns in repeats whose duration is longer than this value.
1067 The @code{Page_turn_engraver} does not respect time-scaled music. For example, the
1068 following example does not behave as expected:
1071 \new Staff \with @{ \consists "Page_turn_engraver" @}
1074 R1 | % a page turn will be allowed here
1075 a4 b \times 2/3 @{c d e@} |
1076 R1 | % a page turn will NOT be allowed here
1081 There should only be one @code{Page_turn_engraver} in a score. If there is more
1082 than one, they will interfere with each other.
1085 @node Displaying spacing
1086 @section Displaying spacing
1088 @funindex annotate-spacing
1089 @cindex Spacing, display of properties
1091 To graphically display the dimensions of vertical properties
1092 that may be altered for page formatting, use
1095 \paper { annotate-spacing = ##t }
1100 @c FIXME: really bad vagueness due to bug in annotate-spacing. -gp
1101 Some unit dimensions are measured in staff spaces, while others
1102 are measured in millimeters.
1104 (@var{a},@var{b}) are intervals, where @var{a} is the lower edge and
1105 @var{b} the upper edge of the interval.