]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/user/spacing.itely
lilypond-book robustness: ensure EOL at the end of @verbatim
[lilypond.git] / Documentation / user / spacing.itely
index c4e303010e86d4fbbe976b90a19c2b8ea260739e..fd7e52140a37ea77a7937519301c77338f48bd81 100644 (file)
@@ -7,7 +7,7 @@
     version that you are working on.  See TRANSLATION for details.
 @end ignore
 
-@c \version "2.11.61"
+@c \version "2.12.0"
 
 @ignore
 GDP TODO list
@@ -162,7 +162,6 @@ the variables.
 
 
 @seealso
-
 Installed Files:
 @file{scm/@/paper@/.scm}.
 
@@ -350,7 +349,6 @@ page given the system to put on it.
 
 
 @seealso
-
 Notation Reference:
 @ref{Vertical spacing between systems}.
 
@@ -414,7 +412,6 @@ first system.  Default: @code{0}, as determined by
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -473,6 +470,17 @@ never consider blank pages in the middle of a score.  Default:
 The value of the page number on the first page.  Default:
 @code{#1}.
 
+@item max-systems-per-page
+The maximum number of systems that will be placed on a page. This
+is currently supported only by the @code{ly:optimal-breaking} algorithm.
+Default: unset.
+
+@item min-systems-per-page
+The minimum number of systems that will be placed on a page. This
+may cause pages to be overfilled if it is made too large. This is
+currently supported only by the @code{ly:optimal-breaking} algorithm.
+Default: unset.
+
 @item page-breaking-between-system-padding
 @funindex page-breaking-between-system-padding
 
@@ -552,6 +560,9 @@ page.  Default: @code{##t}.
 Pieces that amply fill two pages or more should have this set to
 true.
 
+It also affects the last page of book parts, ie parts of a book created
+with @code{\bookpart} blocks.
+
 @item ragged-right
 @funindex ragged-right
 
@@ -561,8 +572,8 @@ systems end at their natural horizontal length.  Default:
 
 If the score has only one system, the default value is @code{##t}.
 
-@item systemSeparatorMarkup
-@funindex systemSeparatorMarkup
+@item system-separator-markup
+@funindex system-separator-markup
 
 A markup object that is inserted between systems.  This is often
 used for orchestral scores.  Default: unset.
@@ -577,7 +588,7 @@ default,  for example
     \relative { c1 \break c1 }
   }
   \paper {
-    systemSeparatorMarkup = \slashSeparator
+    system-separator-markup = \slashSeparator
   }
 }
 @end lilypond
@@ -588,11 +599,17 @@ default,  for example
 The number of systems to be used for a score.
 Default: unset.
 
+@item systems-per-page
+@funindex systems-per-page
+
+The number of systems that should be placed on each page.
+This is currently supported only by the @code{ly:optimal-breaking} algorithm.
+Default: unset.
+
 @end table
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -709,13 +726,8 @@ These fonts are available in any sizes.  The context property
 @rinternals{StaffSymbol}) can be used to tune the size for individual
 staves.  The sizes of individual staves are relative to the global size.
 
-@example
-
-@end example
-
 
 @seealso
-
 Notation Reference:
 @ref{Selecting notation font size}.
 
@@ -753,7 +765,6 @@ layout.
 
 
 @seealso
-
 Notation Reference:
 @ref{Changing context default settings}.
 
@@ -847,15 +858,14 @@ complicated.  More details are available in
 
 
 @predefined
-
 @funindex \break
 @code{\break},
 @funindex \noBreak
 @code{\noBreak}.
+@endpredefined
 
 
 @seealso
-
 Internals Reference:
 @rinternals{LineBreakEvent}.
 
@@ -931,17 +941,49 @@ 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.
 
+@funindex \bookpart
 
-@predefined
+When a book has many scores and pages, the page breaking problem may be
+difficult to solve, requiring large processing time and memory.  To ease
+the page breaking process, @code{\bookpart} blocks are used to divide
+the book into several parts: the page breaking occurs separately on each
+part.  Different page breaking functions may also be used in different
+book parts.
 
+@example
+\bookpart @{
+  \header @{
+    subtitle = "Preface"
+  @}
+  \paper @{
+     %% In a part consisting mostly of text,
+     %% ly:minimal-breaking may be prefered
+     #(define page-breaking ly:minimal-breaking)
+  @}
+  \markup @{ @dots{} @}
+  @dots{}
+@}
+\bookpart @{
+  %% In this part, consisting of music, the default optimal
+  %% page breaking function is used.
+  \header @{
+    subtitle = "First movement"
+  @}
+  \score @{ @dots{} @}
+  @dots{}
+@}
+@end example
+
+
+@predefined
 @funindex \pageBreak
 @code{\pageBreak},
 @funindex \noPageBreak
 @code{\noPageBreak}.
+@endpredefined
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -958,7 +1000,6 @@ cramping and stretching, both horizontally and vertically.  Unlike
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -1030,17 +1071,16 @@ top-level markups.
 
 
 @predefined
-
 @funindex \pageTurn
 @code{\pageTurn},
 @funindex \noPageTurn
 @code{\noPageTurn},
 @funindex \allowPageTurn
 @code{\allowPageTurn}.
+@endpredefined
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -1070,7 +1110,6 @@ too slow or memory demanding, or a lot of texts.  It is enabled using:
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -1119,7 +1158,6 @@ page breaks at explicit @code{\pageBreak} commands and nowhere else.
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -1203,7 +1241,6 @@ This pattern becomes especially helpful when overriding
 
 
 @seealso
-
 Notation Reference:
 @ref{Vertical spacing}.
 
@@ -1335,7 +1372,6 @@ the @code{Axis_group_engraver}.
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -1400,7 +1436,6 @@ the last one.
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -1457,10 +1492,10 @@ example @code{NonMusicalPaperColumn} overrides with the special
 \overrideProperty NonMusicalPaperColumn
   #'line-break-system-details #'((X-offset . 20) (Y-offset . 40))
 
-\override NonMusicalPaperColumn
+\overrideProperty NonMusicalPaperColumn
   #'line-break-system-details #'((alignment-offsets . (0 -15)))
 
-\override NonMusicalPaperColumn
+\overrideProperty NonMusicalPaperColumn
   #'line-break-system-details #'((X-offset . 20) (Y-offset . 40)
                                  (alignment-offsets . (0 -15)))
 @end example
@@ -1468,20 +1503,29 @@ example @code{NonMusicalPaperColumn} overrides with the special
 To understand how each of these different settings work, we begin
 by looking at an example that includes no overrides at all.
 
-@lilypond[quote,ragged-right]
-\new Score <<
-  \new Staff <<
-    \new Voice {
-      s1 * 6 \break
-      s1 * 6 \break
-      s1 * 6 \break
-    }
-    \new Voice { \repeat unfold 18 { c'4 c'4 c'4 c'4 } }
-  >>
-  \new Staff {
-    \repeat unfold 18 { d'4 d'4 d'4 d'4 }
+@c \book { } is required in these examples to ensure the spacing
+@c overrides can be seen between systems. -np
+
+@lilypond[quote]
+\header { tagline = ##f }
+\paper { left-margin = 0\mm }
+\book {
+  \score {
+    <<
+      \new Staff <<
+        \new Voice {
+          s1*5 \break
+          s1*5 \break
+          s1*5 \break
+        }
+        \new Voice { \repeat unfold 15 { c'4 c' c' c' } }
+      >>
+      \new Staff {
+        \repeat unfold 15 { d'4 d' d' d' }
+      }
+    >>
   }
->>
+}
 @end lilypond
 
 This score isolates line- and page-breaking information in a dedicated
@@ -1495,26 +1539,32 @@ the vertical startpoint of each system explicitly, we can set
 the @code{Y-offset} pair in the @code{line-break-system-details}
 attribute of the @code{NonMusicalPaperColumn} grob:
 
-@lilypond[quote,ragged-right]
-\new Score <<
-  \new Staff <<
-    \new Voice {
-      \overrideProperty #"Score.NonMusicalPaperColumn"
-        #'line-break-system-details #'((Y-offset . 0))
-      s1 * 6 \break
-      \overrideProperty #"Score.NonMusicalPaperColumn"
-        #'line-break-system-details #'((Y-offset . 40))
-      s1 * 6 \break
-      \overrideProperty #"Score.NonMusicalPaperColumn"
-        #'line-break-system-details #'((Y-offset . 80))
-      s1 * 6 \break
-    }
-    \new Voice { \repeat unfold 18 { c'4 c'4 c'4 c'4 } }
-  >>
-  \new Staff {
-    \repeat unfold 18 { d'4 d'4 d'4 d'4 }
+@lilypond[quote]
+\header { tagline = ##f }
+\paper { left-margin = 0\mm }
+\book {
+  \score {
+    <<
+      \new Staff <<
+        \new Voice {
+          \overrideProperty #"Score.NonMusicalPaperColumn"
+            #'line-break-system-details #'((Y-offset . 0))
+          s1*5 \break
+          \overrideProperty #"Score.NonMusicalPaperColumn"
+            #'line-break-system-details #'((Y-offset . 40))
+          s1*5 \break
+          \overrideProperty #"Score.NonMusicalPaperColumn"
+            #'line-break-system-details #'((Y-offset . 80))
+          s1*5 \break
+        }
+        \new Voice { \repeat unfold 15 { c'4 c' c' c' } }
+      >>
+      \new Staff {
+        \repeat unfold 15 { d'4 d' d' d' }
+      }
+    >>
   }
->>
+}
 @end lilypond
 
 Note that @code{line-break-system-details} takes an associative list of
@@ -1527,29 +1577,35 @@ explicitly, we can also set the vertical startpoint of each staff
 within each system manually.  We do this using the @code{alignment-offsets}
 subproperty of @code{line-break-system-details}.
 
-@lilypond[quote,ragged-right]
-\new Score <<
-  \new Staff <<
-    \new Voice {
-      \overrideProperty #"Score.NonMusicalPaperColumn"
-        #'line-break-system-details #'((Y-offset . 20)
-          (alignment-offsets . (0 -15)))
-      s1 * 6 \break
-      \overrideProperty #"Score.NonMusicalPaperColumn"
-        #'line-break-system-details #'((Y-offset . 60)
-          (alignment-offsets . (0 -15)))
-      s1 * 6 \break
-      \overrideProperty #"Score.NonMusicalPaperColumn"
-        #'line-break-system-details #'((Y-offset . 100)
-          (alignment-offsets . (0 -15)))
-      s1 * 6 \break
-    }
-    \new Voice { \repeat unfold 18 { c'4 c'4 c'4 c'4 } }
-  >>
-  \new Staff {
-    \repeat unfold 18 { d'4 d'4 d'4 d'4 }
+@lilypond[quote]
+\header { tagline = ##f }
+\paper { left-margin = 0\mm }
+\book {
+  \score {
+    <<
+      \new Staff <<
+        \new Voice {
+          \overrideProperty #"Score.NonMusicalPaperColumn"
+            #'line-break-system-details #'((Y-offset . 20)
+                                           (alignment-offsets . (0 -15)))
+          s1*5 \break
+          \overrideProperty #"Score.NonMusicalPaperColumn"
+            #'line-break-system-details #'((Y-offset . 60)
+                                           (alignment-offsets . (0 -15)))
+          s1*5 \break
+          \overrideProperty #"Score.NonMusicalPaperColumn"
+            #'line-break-system-details #'((Y-offset . 100)
+                                           (alignment-offsets . (0 -15)))
+          s1*5 \break
+        }
+        \new Voice { \repeat unfold 15 { c'4 c' c' c' } }
+      >>
+      \new Staff {
+        \repeat unfold 15 { d'4 d' d' d' }
+      }
+    >>
   }
->>
+}
 @end lilypond
 
 Note that here we assign two different values to the
@@ -1562,34 +1618,36 @@ additional spacing parameters (including, for example, a corresponding
 every system and every staff.  Finally, note that @code{alignment-offsets}
 specifies the vertical positioning of staves but not of staff groups.
 
-@lilypond[quote,ragged-right]
-\new Score <<
-  \new Staff <<
-    \new Voice {
-      \overrideProperty #"Score.NonMusicalPaperColumn"
-      #'line-break-system-details #'((Y-offset . 0)
-        (alignment-offsets . (0 -30 -40)))
-      s1 * 6 \break
-      \overrideProperty #"Score.NonMusicalPaperColumn"
-      #'line-break-system-details #'((Y-offset . 60)
-        (alignment-offsets . (0 -10 -20)))
-      s1 * 6 \break
-      \overrideProperty #"Score.NonMusicalPaperColumn"
-      #'line-break-system-details #'((Y-offset . 100)
-        (alignment-offsets . (0 -10, -40)))
-      s1 * 6 \break
-    }
-    \new Voice { \repeat unfold 18 { c'4 c'4 c'4 c'4 } }
-  >>
-  \new StaffGroup <<
-    \new Staff {
-      \repeat unfold 18 { d'4 d'4 d'4 d'4 }
-    }
-    \new Staff {
-      \repeat unfold 18 { e'4 e'4 e'4 e'4 }
-    }
-  >>
->>
+@lilypond[quote]
+\header { tagline = ##f }
+\paper { left-margin = 0\mm }
+\book {
+  \score {
+    <<
+      \new Staff <<
+        \new Voice {
+          \overrideProperty #"Score.NonMusicalPaperColumn"
+            #'line-break-system-details #'((Y-offset . 0)
+                                           (alignment-offsets . (0 -30 -40)))
+          s1*5 \break
+          \overrideProperty #"Score.NonMusicalPaperColumn"
+            #'line-break-system-details #'((Y-offset . 60)
+                                           (alignment-offsets . (0 -10 -20)))
+          s1*5 \break
+          \overrideProperty #"Score.NonMusicalPaperColumn"
+            #'line-break-system-details #'((Y-offset . 100)
+                                           (alignment-offsets . (0 -10 -40)))
+          s1*5 \break
+        }
+        \new Voice { \repeat unfold 15 { c'4 c' c' c' } }
+      >>
+      \new StaffGroup <<
+        \new Staff { \repeat unfold 15 { d'4 d' d' d' } }
+        \new Staff { \repeat unfold 15 { e'4 e' e' e' } }
+      >>
+    >>
+  }
+}
 @end lilypond
 
 Some points to consider:
@@ -1611,7 +1669,6 @@ passed to these different settings will avoid this.
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -1676,7 +1733,6 @@ lilypond <file>.ly
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -1737,29 +1793,31 @@ c^"This text is padded away from the previous text"
 c^"This text is placed close to the previous text"
 @end lilypond
 
-TODO: this example doesn't work any more ?
 
-By default, outside-staff objects are placed without regard to
-their horizontal distance from the previously-positioned grobs.  This
+By default, outside-staff objects are placed only to avoid
+a horizontal collision with 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}
+other horizontally.  The vertical spacing between staffs can
+also be set so that outside staff objects are interleaved.
+Setting @code{outside-staff-horizontal-padding}
 causes an object to be offset vertically so that such a situation
 doesn't occur.
 
 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
 % the markup is too close to the following note
-c2^"Text"
+c4^"Text"
+c4
 c''2
 % setting outside-staff-horizontal-padding fixes this
 R1
 \once \override TextScript #'outside-staff-horizontal-padding = #1
-c,,2^"Text"
+c,,4^"Text"
+c4
 c''2
 @end lilypond
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -1868,7 +1926,6 @@ Proportional notation is supported; see @ref{Proportional notation}.
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -1876,15 +1933,16 @@ Internals Reference:
 @rinternals{SpacingSpanner},
 @rinternals{NoteSpacing},
 @rinternals{StaffSpacing},
-@rinternals{SeparationItem}.
+@rinternals{NonMusicalPaperColumn}.
 
 
 @knownissues
 
 There is no convenient mechanism to manually override spacing.  The
-following work-around may be used to insert extra space into a score.
+following work-around may be used to insert extra space into a score,
+adjusting the padding value as necessary.
 @example
- \once \override Score.SeparationItem #'padding = #1
+ \override Score.NonMusicalPaperColumn #'padding = #10
 @end example
 
 No work-around exists for decreasing the amount of space.
@@ -1915,7 +1973,6 @@ may be used in that location.
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -2002,7 +2059,6 @@ regard for clefs, bar lines, and grace notes,
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -2055,7 +2111,6 @@ paragraph, the last line simply takes its natural horizontal length.
 
 
 @seealso
-
 Snippets:
 @rlsr{Spacing}.
 
@@ -2404,7 +2459,6 @@ for these related settings.
 
 
 @seealso
-
 Notation Reference:
 @ref{New spacing area}.
 
@@ -2450,19 +2504,37 @@ that may be altered for page formatting, set
 }
 @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.
+All layout dimensions are displayed in staff-spaces, regardless
+of the units specified in the @code{\paper} or @code{\layout} block.
+In the above example, @code{paper-height} has a value of 59.75
+@code{staff-spaces}, and the @code{staff-size} is 20 points (the
+default value). Note that:
 
+@multitable {1 staff-space} {staff-size)/4 * (25.4/72.27) mm}
 
-@seealso
+@item 1 point
+@tab = (25.4/72.27) mm
 
+@item 1 staff-space
+@tab = (@code{staff-size})/4 pts
+@item
+@tab = (@code{staff-size})/4 * (25.4/72.27) mm
+
+@end multitable
+
+@noindent
+In this case, one @code{staff-space} is approximately equal to
+1.757mm. Thus the @code{paper-height} measurement of 59.75
+@code{staff-spaces} is equivalent to 105 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.
+
+
+@seealso
+@ref{Setting the staff size}
 Snippets:
 @rlsr{Spacing}.
 
@@ -2492,9 +2564,14 @@ there is no blank space at the bottom of the page.
 @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.
+Force the number of systems.  This can help in two ways.  Just
+setting a value, even the same value as the number of systems
+being typeset by default, will sometimes cause more systems to
+be fitted onto each page, as an estimation step is then bypassed,
+giving a more accurate fit to each page.  Also, forcing an actual
+reduction in the number of systems may save a further page. For
+example, if the default layout has 11 systems, the following
+assignment will force a layout with 10 systems.
 
 @example
 \paper @{
@@ -2567,7 +2644,6 @@ block so that it applies to the whole score.
 
 
 @seealso
-
 Notation Reference:
 @ref{Page formatting},
 @ref{Changing horizontal spacing}.