]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/page.itely
New spacing docs and editing to global.itely and page.itely. Other
[lilypond.git] / Documentation / user / page.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
3
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
7
8 @node Spacing issues
9 @chapter Spacing issues
10
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.
16
17 Globally spoken, this procedure happens in three steps: first,
18 flexible distances (``springs'') are chosen, based on durations.  All
19 possible line breaking combinations are tried, and the one with the
20 best results -- a layout that has uniform density and requires as
21 little stretching or cramping as possible -- is chosen.
22
23 After spacing and linebreaking, the systems are distributed across
24 pages, taking into account the size of the page, and the size of the
25 titles.
26
27 @menu
28 * Paper and pages::             
29 * Music layout::                
30 * Vertical spacing::            
31 * Horizontal spacing::          
32 * Breaks::                      
33 * Displaying spacing::          
34 @end menu
35
36
37 @node Paper and pages
38 @section Paper and pages
39
40 This section deals with the boundaries that define the area
41 that music can be printed inside.
42
43 @menu
44 * Paper size::                  
45 * Page formatting::             
46 @end menu
47
48
49 @node Paper size
50 @subsection Paper size
51
52 @cindex paper size
53 @cindex page size
54 @findex papersize
55
56 To change the paper size, there are two commands,
57 @example
58 #(set-default-paper-size "a4")
59 \paper @{
60   #(set-paper-size "a4")
61 @}
62 @end example
63
64 The first command sets the size of all pages.  The second command sets the
65 size
66 of the pages that the @code{\paper} block applies to -- if the @code{\paper}
67 block is at the top of the file, then it will apply to all pages.  If the
68 @code{\paper} block is inside a @code{\book}, then the paper size will only
69 apply to that book.
70
71 Support for the following paper sizes are included by default,
72 @code{a6}, @code{a5}, @code{a4}, @code{a3}, @code{legal}, @code{letter},
73 @code{11x17} (also known as tabloid).
74
75 Extra sizes may be added by editing the definition for
76 @code{paper-alist} in the initialization file @file{scm/paper.scm}.
77
78 @cindex orientation
79 @cindex landscape
80
81 If the symbol @code{landscape} is supplied as an argument to
82 @code{set-default-paper-size}, the pages will be rotated by 90 degrees,
83 and wider line widths will be set correspondingly.
84
85 @example
86 #(set-default-paper-size "a6" 'landscape)
87 @end example
88
89 Setting the paper size will adjust a number of @code{\paper} variables
90 (such as margins).  To use a particular paper size with altered
91 @code{\paper} variables, set the paper size before setting the variables.
92
93
94 @node Page formatting
95 @subsection Page formatting
96
97 @cindex page formatting
98 @cindex margins
99 @cindex header, page
100 @cindex footer, page
101
102 LilyPond will do page layout, set margins, and add headers and
103 footers to each page.
104
105 The default layout responds to the following settings in the
106 @code{\paper} block.
107
108 @findex \paper
109
110 @quotation
111 @table @code
112 @findex first-page-number
113 @item first-page-number
114 The value of the page number of the first page.  Default is@tie{}1.
115
116 @findex printfirst-page-number
117 @item printfirst-page-number
118 If set to true, will print the page number in the first page.  Default is
119 false.
120
121 @findex print-page-number
122 @item print-page-number
123 If set to false, page numbers will not be printed.
124
125 @findex paper-width
126 @item paper-width
127 The width of the page.
128
129 @findex paper-height
130 @item paper-height
131 The height of the page.
132
133 @findex top-margin
134 @item top-margin
135 Margin between header and top of the page.
136
137 @findex bottom-margin
138 @item bottom-margin
139 Margin between footer and bottom of the page.
140
141 @findex left-margin
142 @item left-margin
143 Margin between the left side of the page and the beginning of the music.
144
145 @findex line-width
146 @item line-width
147 The length of the systems.
148
149 @findex head-separation
150 @item head-separation
151 Distance between the top-most music system and the page header.
152
153 @findex foot-separation
154 @item foot-separation
155 Distance between the bottom-most music system and the page footer.
156
157 @findex page-top-space
158 Distance from the top of the printable area to the center of the first
159 staff. This only works for staves which are vertically small. Big staves
160 are set with the top of their bounding box aligned to the top of the
161 printable area.
162
163 @findex ragged-bottom
164 @item ragged-bottom
165 If set to true, systems will not be spread vertically across the page.  This
166 does not affect the last page.
167
168 This should be set to true for pieces that have only two or three
169 systems per page, for example orchestral scores.
170
171 @findex ragged-last-bottom
172 @item ragged-last-bottom
173 If set to false, systems will be spread vertically to fill the last page.
174
175 Pieces that amply fill two pages or more should have this set to
176 true.
177
178 @findex system-count
179 @item system-count
180 This variable, if set, specifies into how many lines a score should be
181 broken.
182
183 @findex between-system-space
184 @item between-system-space
185 This dimensions determines the distance between systems.  It is the
186 ideal distance between the center of the bottom staff of one system
187 and the center of the top staff of the next system.
188
189 Increasing this will provide a more even appearance of the page at the
190 cost of using more vertical space.
191
192 @findex between-system-padding
193 @item between-system-padding
194 This dimension is the minimum amount of white space that will always
195 be present between the bottom-most symbol of one system, and the
196 top-most of the next system.
197
198 Increasing this will put systems whose bounding boxes almost touch
199 farther apart.
200
201
202 @findex horizontal-shift
203 @item horizontal-shift
204 All systems (including titles and system separators) are shifted by
205 this amount to the right. Page markup, such as headers and footers are
206 not affected by this. The purpose of this variable is to make space
207 for instrument names at the left.
208
209 @findex after-title-space
210 @item after-title-space
211 Amount of space between the title and the first system.
212
213 @findex after-title-space
214 @item before-title-space
215 Amount of space between the last system of the previous piece and the
216 title of the next.
217
218 @findex between-title-space
219 @item between-title-space
220 Amount of space between consecutive titles (e.g., the title of the
221 book and the title of a piece).
222
223 @findex printallheaders
224 @item printallheaders
225 Setting this to #t will print all headers for each \score in a
226 \book.  Normally only the piece and opus \headers are printed.
227
228 @findex systemSeparatorMarkup
229 @item systemSeparatorMarkup
230 This contains a markup object, which will be inserted between
231 systems.  This is often used for orchestral scores.
232
233 The markup command @code{\slashSeparator} is provided as a sensible
234 default,  for example
235
236 @lilypond[ragged-right]
237 \book {
238   \score {
239     \relative { c1 \break c1 }
240   }
241   \paper {
242     systemSeparatorMarkup = \slashSeparator
243   }
244 }
245 @end lilypond
246
247
248 @end table
249 @end quotation
250
251 Example:
252
253 @example
254 \paper@{
255   paper-width = 2\cm
256   top-margin = 3\cm
257   bottom-margin = 3\cm
258   ragged-last-bottom = ##t
259 @}
260 @end example
261
262 You can also define these values in Scheme.  In that case @code{mm},
263 @code{in}, @code{pt}, and @code{cm} are variables defined in
264 @file{paper-defaults.ly} with values in millimeters.  That is why the
265 value must be multiplied in the example
266
267 @example
268 \paper @{
269   #(define bottom-margin (* 2 cm))
270 @}
271 @end example
272
273 The header and footer are created by the functions @code{make-footer}
274 and @code{make-header}, defined in @code{\paper}.  The default
275 implementations are in @file{ly/@/paper@/-defaults@/.ly} and
276 @file{ly/@/titling@/-init@/.ly}.
277
278 The page layout itself is done by two functions in the
279 @code{\paper} block, @code{page-music-height} and
280 @code{page-make-stencil}.  The former tells the line-breaking algorithm
281 how much space can be spent on a page, the latter creates the actual
282 page given the system to put on it.
283
284
285 @refbugs
286
287 The option right-margin is defined but doesn't set the right margin
288 yet.  The value for the right margin has to be defined adjusting the
289 values of @code{left-margin} and @code{line-width}.
290
291 The default page header puts the page number and the @code{instrument}
292 field from the @code{\header} block on a line.
293
294 The titles (from the @code{\header@{@}} section) are treated as a
295 system, so @code{ragged-bottom} and @code{ragged-last-bottom} will
296 add space between the titles and the first system of the score.
297
298
299 @node Music layout
300 @section Music layout
301
302 @menu
303 * Setting global staff size::   
304 * Score layout::                
305 @end menu
306
307
308 @node Setting global staff size
309 @subsection Setting global staff size
310
311 @cindex font size, setting
312 @cindex staff size, setting
313 @findex layout file
314
315 To set the global staff size, use @code{set-global-staff-size}.
316
317 @example
318 #(set-global-staff-size 14)
319 @end example
320
321 @noindent
322 This sets the global default size to 14pt staff height and scales all
323 fonts accordingly.
324
325 The Feta font provides musical symbols at eight different
326 sizes.  Each font is tuned for a different staff size: at a smaller size
327 the font becomes heavier, to match the relatively heavier staff lines.
328 The recommended font sizes are listed in the following table:
329
330 @quotation
331 @multitable @columnfractions .15 .2 .22 .2
332
333 @item @b{font name}
334 @tab @b{staff height (pt)}
335 @tab @b{staff height (mm)}
336 @tab @b{use}
337
338 @item feta11
339 @tab 11.22
340 @tab 3.9
341 @tab pocket scores
342
343 @item feta13
344 @tab 12.60
345 @tab 4.4
346 @tab
347
348 @item feta14
349 @tab 14.14
350 @tab 5.0
351 @tab
352
353 @item feta16
354 @tab 15.87
355 @tab 5.6
356 @tab
357
358 @item feta18
359 @tab 17.82
360 @tab 6.3
361 @tab song books
362
363 @item feta20
364 @tab 20
365 @tab 7.0
366 @tab standard parts
367
368 @item feta23
369 @tab 22.45
370 @tab 7.9
371 @tab
372
373 @item feta26
374 @tab 25.2
375 @tab 8.9
376 @tab
377 @c modern rental material?
378
379 @end multitable
380 @end quotation
381
382 These fonts are available in any sizes.  The context property
383 @code{fontSize} and the layout property @code{staff-space} (in
384 @internalsref{StaffSymbol}) can be used to tune the size for individual
385 staves.  The sizes of individual staves are relative to the global size.
386
387 @example
388
389 @end example
390
391 @seealso
392
393 This manual: @ref{Selecting notation font size}.
394
395
396 @node Score layout
397 @subsection Score layout
398
399 @findex \layout
400
401 While @code{\paper} contains settings that relate to the page formatting
402 of the whole document, @code{\layout} contains settings for score-specific
403 layout.
404
405 @example
406 \layout @{
407   indent = 2.0\cm
408   \context @{ \Staff
409     \override VerticalAxisGroup #'minimum-Y-extent = #'(-6 . 6)
410   @}
411   \context @{ \Voice
412     \override TextScript #'padding = #1.0
413     \override Glissando #'thickness = #3
414   @}
415 @}
416 @end example
417
418
419 @seealso
420
421 This manual: @ref{Changing context default settings}
422
423
424 @node Vertical spacing
425 @section Vertical spacing
426
427 @cindex vertical spacing
428
429 Vertical spacing is controlled by three things: the amount of
430 space available (i.e. paper size and margins), the amount of
431 space between systems, and the amount of space between
432 staves inside a system.
433
434 @menu
435 * Vertical spacing inside a system::  
436 * Vertical spacing of piano staves::  
437 * Vertical spacing between systems::  
438 * Controlling spacing of individual systems::  
439 @end menu
440
441
442 @node Vertical spacing inside a system
443 @subsection Vertical spacing inside a system
444
445 @cindex distance between staves
446 @cindex staff distance
447 @cindex space between staves
448 @cindex space inside systems
449
450 The height of each system is determined automatically.  To prevent
451 staves from bumping into each other, some minimum distances are set.
452 By changing these, you can put staves closer together.  This
453 reduces the amount of space each system requires, and may result
454 in having more systems per page.
455
456 Normally staves are stacked vertically.  To make staves maintain a
457 distance, their vertical size is padded.  This is done with the
458 property @code{minimum-Y-extent}.  When applied to a
459 @internalsref{VerticalAxisGroup}, it controls the size of a horizontal
460 line, such as a staff or a line of lyrics.  @code{minimum-Y-extent}
461 takes a pair of numbers, so
462 if you want to make it smaller than its default @code{#'(-4 . 4)}
463 then you could set
464
465 @example
466 \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)
467 @end example
468
469 @noindent
470 This sets the vertical size of the current staff to 3 staff spaces on
471 either side of the center staff line.  The value @code{(-3 . 3)} is
472 interpreted as an interval, where the center line is the 0, so the
473 first number is generally negative.  The numbers need not match;
474 for example, the staff can be made larger at the bottom by setting
475 it to @code{(-6 . 4)}.
476
477
478 @seealso
479
480 Internals: Vertical alignment of staves is handled by the
481 @internalsref{VerticalAlignment} object. The context parameters
482 specifying the vertical extent are described in connection with
483 the @internalsref{Axis_group_engraver}.
484
485 Example files: @inputfileref{input/regression/,page-spacing.ly},
486 @inputfileref{input/regression/,alignment-vertical-spacing.ly}.
487
488
489 @node Vertical spacing of piano staves
490 @subsection Vertical spacing of piano staves
491
492 The distance between staves of a @internalsref{PianoStaff} cannot be
493 computed during formatting.  Rather, to make cross-staff beaming work
494 correctly, that distance has to be fixed beforehand.
495
496 The distance of staves in a @code{PianoStaff} is set with the
497 @code{forced-distance} property of the
498 @internalsref{VerticalAlignment} object, created in
499 @internalsref{PianoStaff}.
500
501 It can be adjusted as follows
502 @example
503 \new PianoStaff \with @{
504   \override VerticalAlignment #'forced-distance = #7
505 @} @{
506   ...
507 @}
508 @end example
509
510 @noindent
511 This would bring the staves together at a distance of 7 staff spaces,
512 measured from the center line of each staff.
513
514 The difference is demonstrated in the following example,
515 @lilypond[quote,verbatim]
516 \relative c'' <<
517   \new PianoStaff \with {
518     \override VerticalAlignment #'forced-distance = #7
519   } <<
520     \new Staff { c1 }
521     \new Staff { c }
522   >>
523   \new PianoStaff <<
524     \new Staff { c }
525     \new Staff { c }
526   >>
527 >>
528 @end lilypond
529
530
531 @seealso
532
533 Example files: @inputfileref{input/regression/,alignment-vertical-spacing.ly}.
534
535
536 @node Vertical spacing between systems
537 @subsection Vertical spacing between systems
538
539 Space between systems are controlled by four @code{\paper} variables,
540
541 @example
542 \paper @{
543   between-system-space = 1.5\cm
544   between-system-padding = #1
545   ragged-bottom=##f
546   ragged-last-bottom=##f
547 @}
548 @end example
549
550
551 @node Controlling spacing of individual systems
552 @subsection Controlling spacing of individual systems
553
554 It is also possible to change the distance between for each system
555 individually.  This is done by including the command
556
557 @example
558 \overrideProperty
559 #"Score.NonMusicalPaperColumn"
560 #'line-break-system-details
561 #'((fixed-alignment-extra-space . 15))
562 @end example
563
564 @noindent
565 at the line break before the system to be changed. The distance
566 @code{15} is distributed over all staves that have a fixed distance
567 alignment.  For example,
568
569 @lilypond[ragged-right, fragment, relative=2, staffsize=13]
570 \new PianoStaff <<
571   \new Staff {
572     c1\break
573   
574     \overrideProperty
575     #"Score.NonMusicalPaperColumn"
576     #'line-break-system-details
577     #'((fixed-alignment-extra-space . 15))
578
579     c\break
580   }
581   \new Staff { c c }
582 >>
583 @end lilypond
584
585 The distance for @code{fixed-alignment-extra-space} may also be
586 negative.
587
588
589
590 @node Horizontal spacing
591 @section Horizontal Spacing
592
593 @menu
594 * Horizontal Intro::            
595 * Line length::                 
596 @end menu
597
598
599 @node Horizontal Intro
600 @subsection Horizontal Intro
601
602 The spacing engine translates differences in durations into stretchable
603 distances (``springs'') of differring lengths.  Longer durations get
604 more space, shorter durations get less.  The shortest durations get a
605 fixed amount of space (which is controlled by
606 @code{shortest-duration-space} in the @internalsref{SpacingSpanner}
607 object).  The longer the duration, the more space it gets: doubling a
608 duration adds a fixed amount (this amount is controlled by
609 @code{spacing-increment}) of space to the note.
610
611 For example, the following piece contains lots of half, quarter, and
612 8th notes; the eighth note is followed by 1 note head width (NHW).
613 The quarter note is followed by 2 NHW, the half by 3 NHW, etc.
614
615 @lilypond[quote,fragment,verbatim,relative=1]
616 c2 c4. c8 c4. c8 c4. c8 c8
617 c8 c4 c4 c4
618 @end lilypond
619
620 Normally, @code{spacing-increment} is set to 1.2 staff space, which is
621 approximately the width of a note head, and
622 @code{shortest-duration-space} is set to 2.0, meaning that the
623 shortest note gets 2.4 staff space (2.0 times the
624 @code{spacing-increment}) of horizontal space.  This space is counted
625 from the left edge of the symbol, so the shortest notes are generally
626 followed by one NHW of space.
627
628 If one would follow the above procedure exactly, then adding a single
629 32nd note to a score that uses 8th and 16th notes, would widen up the
630 entire score a lot.  The shortest note is no longer a 16th, but a 32nd,
631 thus adding 1 NHW to every note.  To prevent this, the shortest
632 duration for spacing is not the shortest note in the score, but rather
633 the one which occurs most frequently.
634
635
636 The most common shortest duration is determined as follows: in every
637 measure, the shortest duration is determined.  The most common shortest
638 duration is taken as the basis for the spacing, with the stipulation
639 that this shortest duration should always be equal to or shorter than
640 an 8th note.  The shortest duration is printed when you run
641 @code{lilypond} with the @code{--verbose} option.
642
643 These durations may also be customized.  If you set the
644 @code{common-shortest-duration} in @internalsref{SpacingSpanner}, then
645 this sets the base duration for spacing.  The maximum duration for this
646 base (normally an 8th), is set through @code{base-shortest-duration}.
647
648 @findex common-shortest-duration
649 @findex base-shortest-duration
650 @findex stem-spacing-correction
651 @findex spacing
652
653 Notes that are even shorter than the common shortest note are
654 followed by a space that is proportional to their duration relative to
655 the common shortest note.  So if we were to add only a few 16th notes
656 to the example above, they would be followed by half a NHW:
657
658 @lilypond[quote,fragment,verbatim,relative=2]
659 c2 c4. c8 c4. c16[ c] c4. c8 c8 c8 c4 c4 c4
660 @end lilypond
661
662
663 In the introduction (see @ref{Engraving}), it was explained that stem
664 directions influence spacing.  This is controlled with the
665 @code{stem-spacing-correction} property in the
666 @internalsref{NoteSpacing}, object.  These are generated for every
667 @internalsref{Voice} context.  The @code{StaffSpacing} object
668 (generated in @internalsref{Staff} context) contains the same property
669 for controlling the stem/bar line spacing.  The following example shows
670 these corrections, once with default settings, and once with
671 exaggerated corrections:
672
673 @lilypond[quote,ragged-right]
674 {
675   c'4 e''4 e'4 b'4 |
676   b'4 e''4 b'4 e''4|
677   \override Staff.NoteSpacing #'stem-spacing-correction = #1.5
678   \override Staff.StaffSpacing #'stem-spacing-correction = #1.5
679   c'4 e''4 e'4 b'4 |
680   b'4 e''4 b'4 e''4|
681 }
682 @end lilypond
683
684 Proportional notation is supported; see @ref{Proportional notation}.
685
686 By default, spacing in tuplets depends on various non-duration
687 factors (such as accidentals, clef changes, etc).  To disregard
688 such symbols and force uniform equal-duration spacing, use
689 @code{Score.SpacingSpanner #'uniform-stretching}.  This
690 property can only be changed at the beginning of a score,
691
692 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
693 \new Score \with {
694   \override SpacingSpanner #'uniform-stretching = ##t
695 } <<
696   \new Staff{
697     \times 4/5 {
698       c8 c8 c8 c8 c8
699     }
700     c8 c8 c8 c8
701   }
702   \new Staff{
703     c8 c8 c8 c8
704     \times 4/5 {
705       c8 c8 c8 c8 c8
706     }
707   }
708 >>
709 @end lilypond
710
711
712 When @code{strict-note-spacing} is set, notes are spaced without
713 regard for clefs, bar lines, and grace notes,
714
715 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
716 \override Score.SpacingSpanner #'strict-note-spacing = ##t
717 \new Staff { c8[ c \clef alto c \grace { c16[ c] } c8 c c]  c32[ c32] }
718 @end lilypond
719
720
721 @seealso
722
723 Internals: @internalsref{SpacingSpanner}, @internalsref{NoteSpacing},
724 @internalsref{StaffSpacing}, @internalsref{SeparationItem}, and
725 @internalsref{SeparatingGroupSpanner}.
726
727 @refbugs
728
729 Spacing is determined on a score wide basis.  If you have a score that
730 changes its character (measured in durations) halfway during the
731 score, the part containing the longer durations will be spaced too
732 widely.
733
734 There is no convenient mechanism to manually override spacing.  The
735 following work-around may be used to insert extra space into a score.
736 @example
737  \once \override Score.SeparationItem #'padding = #1
738 @end example
739
740 No work-around exists for decreasing the amount of space.
741
742
743 @node Line length
744 @subsection Line length
745
746 @cindex page breaks
747 @cindex breaking pages
748
749 @findex indent
750 @findex line-width
751 @findex ragged-right
752 @findex ragged-last
753
754 @c Although line-width can be set in \layout, it should be set in paper
755 @c block, to get page layout right.
756 @c Setting indent in \paper block makes not much sense, but it works.
757
758 @c Bit verbose and vague, use examples?
759 The most basic settings influencing the spacing are @code{indent} and
760 @code{line-width}.  They are set in the @code{\layout} block.  They
761 control the indentation of the first line of music, and the lengths of
762 the lines.
763
764 If @code{ragged-right} is set to true in the @code{\layout} block, then
765 systems ends at their natural horizontal length, instead of being spread
766 horizontally to fill the whole line.  This is useful for
767 short fragments, and for checking how tight the natural spacing is.
768
769 @cindex page layout
770 @cindex vertical spacing
771
772 The option @code{ragged-last} is similar to @code{ragged-right}, but
773 only affects the last line of the piece.  No restrictions are put on
774 that line.  The result is similar to formatting text paragraphs.  In a
775 paragraph, the last line simply takes its natural horizontal length.
776 @c Note that for text there are several options for the last line.
777 @c While Knuth TeX uses natural length, lead typesetters use the same
778 @c stretch as the previous line.  eTeX uses \lastlinefit to
779 @c interpolate between both these solutions.
780
781 @example
782 \layout @{
783   indent = #0
784   line-width = #150
785   ragged-last = ##t
786 @}
787 @end example
788
789
790 @node Breaks
791 @section Breaks
792
793 @menu
794 * Line breaking::               
795 * Page breaking::               
796 @end menu
797
798 @node Line breaking
799 @subsection Line breaking
800
801 @cindex line breaks
802 @cindex breaking lines
803
804 Line breaks are normally computed automatically.  They are chosen so
805 that lines look neither cramped nor loose, and that consecutive lines
806 have similar density.
807
808 Occasionally you might want to override the automatic breaks; you can
809 do this by specifying @code{\break}.  This will force a line break at
810 this point.  Line breaks can only occur at places where there are bar
811 lines.  If you want to have a line break where there is no bar line,
812 you can force an invisible bar line by entering @code{\bar
813 ""}.  Similarly, @code{\noBreak} forbids a line break at a
814 point.
815
816
817 @cindex regular line breaks
818 @cindex four bar music.
819
820 For line breaks at regular intervals use @code{\break} separated by
821 skips and repeated with @code{\repeat}:
822 @example
823 << \repeat unfold 7 @{
824          s1 \noBreak s1 \noBreak
825          s1 \noBreak s1 \break @}
826    @emph{the real music}
827 >>
828 @end example
829
830 @noindent
831 This makes the following 28 measures (assuming 4/4 time) be broken every
832 4 measures, and only there.
833
834 @refcommands
835
836 @code{\break}, and @code{\noBreak}.
837 @findex \break
838 @findex \noBreak
839
840 @seealso
841
842 Internals: @internalsref{BreakEvent}.
843
844 A linebreaking configuration can now be saved as a @code{.ly} file
845 automatically.  This allows vertical alignments to be stretched to
846 fit pages in a second formatting run.  This is fairly new and
847 complicated; see @inputfileref{input/regression/,page-layout-twopass.ly}
848 for details.
849
850 @refbugs
851
852 Line breaks can only occur if there is a ``proper'' bar line.  A note
853 which is hanging over a bar line is not proper, such as
854
855 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
856 c4 c2 c2 \break   % this does nothing
857 c2 c4 |           % a break here would work
858 c4 c2 c4 ~ \break % as does this break
859 c4 c2 c4
860 @end lilypond
861
862
863 @node Page breaking
864 @subsection Page breaking
865
866 The default page breaking may be overriden by inserting
867 @code{\pageBreak} or @code{\noPageBreak} commands.  These commands are
868 analogous to @code{\break} and @code{\noBreak}.  They should be
869 inserted at a bar line.  These commands force and forbid a page-break
870 from happening.  Of course, the @code{\pageBreak} command also forces
871 a line break.
872
873 Page breaks are computed by the @code{page-breaking} function in the
874 @code{\paper} block.
875
876 To force a new page for a new piece (in a collection of pieces or a
877 piece in several movements), use @code{breakbefore} in the header.
878
879 @example
880 \header@{
881   breakbefore = ##t
882   piece = ""
883 @}
884 @end example
885
886 @refcommands
887
888 @findex \pageBreak
889 @code{\pageBreak}
890 @findex \noPageBreak
891 @code{\noPageBreak}
892
893
894 @refbugs
895
896 The @code{breakbefore=##t} header requires that there is a @code{piece}
897 header as well.  It may be used as a normal header, or left  blank
898 (@code{=""}) as in the example above, but it must be present.
899
900
901 @node Displaying spacing
902 @section Displaying spacing
903
904 @findex annotate-spacing
905 @cindex Spacing, display of properties
906
907 To graphically display the dimensions of vertical properties
908 that may be altered for page formatting, use
909
910 @lilypond[verbatim]
911 \paper { annotate-spacing = ##t }
912 { c4 }
913 @end lilypond
914
915 @noindent
916 @c  FIXME: really bad vagueness due to bug in annotate-spacing.  -gp
917 Some unit dimensions are measured in staff spaces, while others
918 are measured in millimeters.
919 The pairs
920 (@var{a},@var{b}) are intervals, where @var{a} is the lower edge and
921 @var{b} the upper edge of the interval.
922
923