]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/user/spacing.itely
Merge branch 'master' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond into topic...
[lilypond.git] / Documentation / user / spacing.itely
index fd65dfe0e63272f2d004add8addca6aa673c97da..ac85a6c214f74c5589168492c38ced496343d2b3 100644 (file)
@@ -211,6 +211,13 @@ top-most of the next system. Default is@tie{}4mm.
 Increasing this will put systems whose bounding boxes almost touch
 farther apart.
 
+@funindex page-breaking-between-system-padding
+@item between-system-padding
+This variable tricks the page breaker into thinking that
+@code{between-system-padding} is set to something different than it
+really is. For example, if this variable is set to something substantially
+larger than @code{between-system-padding}, then the page-breaker will put
+fewer systems on each page.
 
 @funindex horizontal-shift
 @item horizontal-shift
@@ -286,6 +293,30 @@ result in the first page number remaining as is or being increased by one.
 @end table
 @end quotation
 
+
+@commonprop
+
+The header and footer are created by the functions make-footer and
+make-header, defined in \paper. The default implementations are in
+ly/paper-defaults.ly and ly/titling-init.ly.
+
+The page layout itself is done by two functions in the \paper block,
+page-music-height and page-make-stencil. The former tells the
+line-breaking algorithm how much space can be spent on a page, the
+latter creates the actual page given the system to put on it.
+
+You can define paper block values in Scheme. In that case mm, in, pt,
+and cm are variables defined in paper-defaults.ly with values in
+millimeters. That is why the value 2 cm must be multiplied in the
+example
+
+@example
+\paper @{
+ #(define bottom-margin (* 2 cm))
+@}
+@end example
+
+
 Example:
 
 @example
@@ -297,6 +328,23 @@ Example:
 @}
 @end example
 
+This second example centers page numbers at the bottom of every page. 
+
+@example
+\paper @{
+  print-page-number = ##t
+  print-first-page-number = ##t
+  oddHeaderMarkup = \markup \fill-line @{ " " @}
+  evenHeaderMarkup = \markup \fill-line @{ " " @}
+  oddFooterMarkup = \markup @{ \fill-line @{
+     \bold \fontsize #3 \on-the-fly #print-page-number-check-first
+     \fromproperty #'page:page-number-string @} @}
+  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},
 @code{in}, @code{pt}, and @code{cm} are variables defined in
 @file{paper-defaults.ly} with values in millimeters.  That is why the
@@ -467,7 +515,7 @@ layout.
 
 @seealso
 
-This manual: @ref{Changing context default settings}
+This manual: @ref{Changing context default settings}.
 
 
 @node Displaying spacing
@@ -559,13 +607,12 @@ This makes the following 28 measures (assuming 4/4 time) be broken every
 
 Internals: @internalsref{LineBreakEvent}.
 
-A linebreaking configuration can now be saved as a @code{.ly} file
+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
 @lsrdir{spacing}
 
-
 @refbugs
 
 Line breaks can only occur if there is a @q{proper} bar line.  A note
@@ -578,22 +625,23 @@ c4 c2 c4 ~ \break % as does this break
 c4 c2 c4
 @end lilypond
 
-To allow line breaks on such bar lines, the
-@code{Forbid_line_break_engraver} can be removed from @code{Voice}
-context, like so
-
+This can be avoided by removing the @code{Forbid_line_break_engraver}
+and adding the line breaks in another voice:
 
-@lilypond[quote,ragged-right,relative=2,fragment,verbatim]
-\new Voice \with {
-  \remove "Forbid_line_break_engraver"
-} {
-  c4 c2 c2 \break   % now the break is allowed
-  c2 c4
-}
+@lilypond[quote,ragged-right,verbatim]
+\new Staff <<
+  \new Voice \with {
+    \remove Forbid_line_break_engraver
+  } {
+    c'4 c'2 c'2 c'2 c'4
+  }
+  \new Voice {
+    s1 \break s1
+  }
+>>
 @end lilypond
 
 
-
 @node Page breaking
 @subsection Page breaking
 
@@ -604,6 +652,9 @@ inserted at a bar line.  These commands force and forbid a page-break
 from happening.  Of course, the @code{\pageBreak} command also forces
 a line break.
 
+The @code{\pageBreak} and @code{\noPageBreak} commands may also be
+inserted at top-level, between scores and top-level markups.
+
 Page breaks are computed by the @code{page-breaking} function.
 LilyPond provides two algorithms for computing page
 breaks, @code{ly:optimal-breaking} and @code{ly:page-turn-breaking}. The
@@ -699,6 +750,19 @@ page turns if the repeat is very short. If you set the context property
 @code{minimumRepeatLengthForPageTurn} then the @code{Page_turn_engraver} will
 only allow turns in repeats whose duration is longer than this value.
 
+The page turning commands, @code{\pageTurn}, @code{\noPageTurn} and
+@code{\allowPageTurn}, may also be used at top-level, between scores and
+top-level markups.
+
+@refcommands
+
+@funindex \pageTurn
+@code{\pageTurn}
+@funindex \noPageTurn
+@code{\noPageTurn}
+@funindex \allowPageTurn
+@code{\allowPageTurn}
+
 @refbugs
 
 There should only be one @code{Page_turn_engraver} in a score. If there is more
@@ -841,7 +905,7 @@ staves inside a system.
 * Vertical spacing inside a system::  
 * Vertical spacing between systems::  
 * Explicit staff and system positioning::  
-* Two-pass vertical spacing::   
+* Two-pass vertical spacing::
 * Vertical collision avoidance::  
 @end menu
 
@@ -881,6 +945,61 @@ first number is generally negative.  The numbers need not match;
 for example, the staff can be made larger at the bottom by setting
 it to @code{(-6 . 4)}.
 
+After page breaks are determined, the vertical spacing within each
+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. To disable this
+stretching entirely, set @code{max-stretch} to zero.
+
+In some situations, you may want to stretch most of a system while
+leaving some parts fixed. For example, if a piano part occurs in the
+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
+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
+the second piano staff:
+
+@lilypond[verbatim]
+#(set-default-paper-size "a6")
+#(set-global-staff-size 14.0)
+
+\book {
+\paper {
+  ragged-last-bottom = ##f
+}
+
+\score {
+\new GrandStaff
+<<
+  \new StaffGroup
+  <<
+    \new Staff {c' d' e' f'}
+    \new Staff {c' d' e' f'}
+    \new Staff {c' d' e' f'}
+  >>
+
+  \new PianoStaff
+  <<
+    \new Staff {c' d' e' f'}
+    \new Staff \with {
+      \override VerticalAxisGroup #'keep-fixed-while-stretching = ##t
+    }
+    {c' d' e' f'}
+  >>
+
+  \new StaffGroup
+  <<
+    \new Staff {c' d' e' f'}
+    \new Staff {c' d' e' f'}
+  >>
+>>
+}
+}
+@end lilypond
 
 @seealso
 
@@ -1116,6 +1235,10 @@ passed to these different settings will avoid this.
 @node Two-pass vertical spacing
 @subsection Two-pass vertical spacing
 
+Warning: two-pass vertical spacing is deprecated and will be removed in
+a future version of LilyPond. Systems are now stretched automatically
+in a single pass. See @ref{Vertical spacing inside a system}.
+
 In order to automatically stretch systems so that they should fill the
 space left on a page, a two-pass technique can be used:
 
@@ -1143,7 +1266,7 @@ music, using the @code{\scoreTweak} music function.
     \new Staff <<
       %% Include this score tweaks:
       \scoreTweak "scoreA"
-      { \clef french c''1 \break c''1 } 
+      { \clef french c''1 \break c''1 }
     >>
     \new Staff { \clef soprano g'1 g'1 }
     \new Staff { \clef mezzosoprano e'1 e'1 }
@@ -1531,11 +1654,11 @@ LilyPond supports five different settings for proportional notation,
 which may be used together or alone:
 
 @itemize
-proportionalNotationDuration
-uniform-stretching
-strict-note-spacing
-\remove Separating_line_group_engraver
-\override PaperColumn #'used = ##t
+@item @code{proportionalNotationDuration}
+@item @code{uniform-stretching}
+@item @code{strict-note-spacing}
+@item @code{\remove Separating_line_group_engraver}
+@item @code{\override PaperColumn #'used = ##t}
 @end itemize
 
 In the examples that follow, we explore these five different
@@ -1747,7 +1870,7 @@ means that, by default, @code{uniform-stretching} is either turned on for the
 entire score or turned off for the entire score.  We can, however,
 override this behavior and turn on different spacing features at
 different places in the score.  We do this with the command
-@code{\newSpacingSection}.  See @ref{New spacing area} for more info.
+@code{\newSpacingSection}.  See @ref{New spacing area}, for more info.
 
 Next we examine the effects of the @code{Separating_line_group_engraver} and
 see why proportional scores frequently remove this engraver.  The following