]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/user/changing-defaults.itely
Merge branch 'master' of git://git.sv.gnu.org/lilypond
[lilypond.git] / Documentation / user / changing-defaults.itely
index 717384d19dc60cafd040219e45e18c436296964c..17a782b8fb9e7424cc9dbf83d863d5e9baf1fcbd 100644 (file)
@@ -56,14 +56,14 @@ notation.  For example, giving each staff a separate time signature.
 @item
 Page layout: changing the appearance of the spacing, line
 breaks, and page dimensions.  These modifications are discussed
-in @ref{Non-musical notation} and @ref{Spacing issues}.
+in @ref{Non-musical notation}, and @ref{Spacing issues}.
 @end itemize
 
 Internally, LilyPond uses Scheme (a LISP dialect) to provide
 infrastructure.  Overriding layout decisions in effect accesses the
 program internals, which requires Scheme input.  Scheme elements are
 introduced in a @code{.ly} file with the hash mark
-@code{#}.@footnote{@ref{Scheme tutorial} contains a short tutorial
+@code{#}.@footnote{@ref{Scheme tutorial}, contains a short tutorial
 on entering numbers, lists, strings, and symbols in Scheme.}
 
 
@@ -93,21 +93,29 @@ Common rules for typesetting accidentals have been placed in a
 function.  This function is called as follows
 
 @funindex set-accidental-style
+@example
+#(set-accidental-style 'STYLE)
+@end example
+
+@c TODO: check the context stuff below
+@c -does it *really* work?
+@c -the default contexts as specified in
+@c  scm/music-function.scm seem to be different -vv
+
+Optionally, the function can take two arguments: the name of the
+accidental style, and an optional argument that denotes the context that
+should be changed:
+
 @example
 #(set-accidental-style 'STYLE #('CONTEXT#))
 @end example
 
-The function can take two arguments: the name of the accidental style,
-and an optional argument that denotes the context that should be
-changed.  If no context name is supplied, @code{Staff} is the default,
+If no context name is supplied, @code{Staff} is the default,
 but you may wish to apply the accidental style to a single @code{Voice}
 instead.
 
-@c TODO: we should create a very clear example, and show every
-@c accidental style on that example (with the example specially
-@c constructed so that it illustrates all the differences).  -gp
+The following accidental styles are supported:
 
-The following accidental styles are supported
 @table @code
 @item default
 This is the default typesetting behavior.  It corresponds
@@ -115,22 +123,64 @@ to 18th century common practice: Accidentals are
 remembered to the end of the measure in which they occur and
 only on their own octave.
 
+@lilypond[quote,ragged-right]
+musicA = {  << \relative {  cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
+       \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
+
+musicB = { \clef bass  \new Voice { \voiceTwo \relative { < fis, a cis>4 
+       \change Staff = up cis' \change Staff = down <fis, a>  
+       \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis 
+       <f a d>2 |  } }}
+
+\score { 
+       \new PianoStaff {
+       << \context Staff = "up" {
+              %#(set-accidental-style 'default) 
+       \musicA }
+       \context Staff = "down"{
+              %#(set-accidental-style 'default)
+       \musicB } >> }
+       \header { piece = \markup {\fill-line { \fontsize #3  "'default" }}}
+}
+@end lilypond
+
 @item voice
 The normal behavior is to remember the accidentals on
 Staff-level.  This variable, however, typesets accidentals
 individually for each voice.  Apart from that, the rule is similar to
 @code{default}.
 
+@example
+ \new Staff <<
+        #(set-accidental-style 'voice)
+       @{ @dots{} @}
+       >>
+@end example
+
 As a result, accidentals from one voice do not get canceled in other
-voices, which is often an unwanted result
-
-@lilypond[quote,ragged-right,relative=1,fragment,verbatim]
-\new Staff <<
-  #(set-accidental-style 'voice)
-  <<
-    { es g } \\
-    { c, e }
->> >>
+voices, which is often an unwanted result: in the following example, it
+is hard to determine whether the second @samp{a} should be played
+natural or sharp.
+
+@lilypond[quote,ragged-right]
+musicA = {  << \relative {  cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
+       \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
+
+musicB = { \clef bass  \new Voice { \voiceTwo \relative { < fis, a cis>4 
+       \change Staff = up cis' \change Staff = down <fis, a>  
+       \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis 
+       <f a d>2 |  } }}
+
+\score { 
+       \new PianoStaff {
+       << \context Staff = "up" {
+              #(set-accidental-style 'voice) 
+       \musicA }
+       \context Staff = "down"{
+              #(set-accidental-style 'voice)
+       \musicB } >> }
+       \header { piece = \markup {\fill-line { \fontsize #3  "'voice" }}}
+}
 @end lilypond
 
 The @code{voice} option should be used if the voices
@@ -145,21 +195,57 @@ This rule corresponds to the common practice in the 20th century.  This rule
 prints the same accidentals as @code{default}, but temporary
 accidentals also are canceled in other octaves.  Furthermore,
 in the same octave, they also get canceled in the following
-measure
+measure: in the following example, notice the two natural signs which appear
+in the second bar of the upper staff.
 
-@lilypond[quote,ragged-right,fragment,verbatim]
-#(set-accidental-style 'modern)
-cis' c'' cis'2 | c'' c'
+@lilypond[quote,ragged-right]
+musicA = {  << \relative {  cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
+       \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
+
+musicB = { \clef bass  \new Voice { \voiceTwo \relative { < fis, a cis>4 
+       \change Staff = up cis' \change Staff = down <fis, a>  
+       \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis 
+       <f a d>2 |  } }}
+
+\score { 
+       \new PianoStaff {
+       << \context Staff = "up" {
+              #(set-accidental-style 'modern) 
+       \musicA }
+       \context Staff = "down"{
+              #(set-accidental-style 'modern)
+       \musicB } >> }
+       \header { piece = \markup {\fill-line { \fontsize #3  "'modern" }}}
+}
 @end lilypond
 
 @item @code{modern-cautionary}
 @funindex modern-cautionary
 This rule is similar to @code{modern}, but the @q{extra} accidentals
 (the ones not typeset by @code{default}) are typeset as cautionary
-accidentals.  They are printed in reduced size or with parentheses
-@lilypond[quote,ragged-right,fragment,verbatim]
-#(set-accidental-style 'modern-cautionary)
-cis' c'' cis'2 | c'' c'
+accidentals.  They are printed in reduced size or (by default)
+with parentheses -- this can be set by definig the @code{cautionary-style}
+property of the @internalsref{AccidentalSuggestion} object.
+
+@lilypond[quote,ragged-right]
+musicA = {  << \relative {  cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
+       \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
+
+musicB = { \clef bass  \new Voice { \voiceTwo \relative { < fis, a cis>4 
+       \change Staff = up cis' \change Staff = down <fis, a>  
+       \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis 
+       <f a d>2 |  } }}
+
+\score { 
+       \new PianoStaff {
+       << \context Staff = "up" {
+              #(set-accidental-style 'modern-cautionary) 
+       \musicA }
+       \context Staff = "down"{
+              #(set-accidental-style 'modern-cautionary)
+       \musicB } >> }
+       \header { piece = \markup {\fill-line { \fontsize #3  "'modern-cautionary" }}}
+}
 @end lilypond
 
 @funindex modern-voice
@@ -169,6 +255,27 @@ playing one voice and musicians playing all voices.  Accidentals are
 typeset for each voice, but they @emph{are} canceled across voices in
 the same @internalsref{Staff}.
 
+@lilypond[quote,ragged-right]
+musicA = {  << \relative {  cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
+       \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
+
+musicB = { \clef bass  \new Voice { \voiceTwo \relative { < fis, a cis>4 
+       \change Staff = up cis' \change Staff = down <fis, a>  
+       \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis 
+       <f a d>2 |  } }}
+
+\score { 
+       \new PianoStaff {
+       << \context Staff = "up" {
+              #(set-accidental-style 'modern-voice) 
+       \musicA }
+       \context Staff = "down"{
+              #(set-accidental-style 'modern-voice)
+       \musicB } >> }
+       \header { piece = \markup {\fill-line { \fontsize #3  "'modern-voice" }}}
+}
+@end lilypond
+
 @funindex modern-voice-cautionary
 @item modern-voice-cautionary
 This rule is the same as @code{modern-voice}, but with the extra
@@ -177,25 +284,120 @@ as cautionaries.  Even though all accidentals typeset by
 @code{default} @emph{are} typeset by this variable,
 some of them are typeset as cautionaries.
 
+@lilypond[quote,ragged-right]
+musicA = {  << \relative {  cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
+       \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
+
+musicB = { \clef bass  \new Voice { \voiceTwo \relative { < fis, a cis>4 
+       \change Staff = up cis' \change Staff = down <fis, a>  
+       \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis 
+       <f a d>2 |  } }}
+
+\score { 
+       \new PianoStaff {
+       << \context Staff = "up" {
+              #(set-accidental-style 'modern-voice-cautionary) 
+       \musicA }
+       \context Staff = "down"{
+              #(set-accidental-style 'modern-voice-cautionary)
+       \musicB } >> }
+       \header { piece = \markup {\fill-line { \fontsize #3  "'modern-voice-cautionary" }}}
+}
+@end lilypond
+
 @item piano
 @funindex piano accidentals
-This rule reflects 20th century practice for piano notation.  Very similar to
-@code{modern} but accidentals also get canceled
+This accidental style takes place in a GrandStaff context. However, you have to 
+explicitly set it for @emph{each} individual Staff of the GrandStaff:
+
+@example
+\new GrandStaff @{ <<
+  \new Staff = "up" @{ <<
+    #(set-accidental-style 'piano)
+    @{ @dots{} @}
+  >> @}
+  \new Staff = "down"@{ <<
+    #(set-accidental-style 'piano)
+  @{ @dots{} @}
+  >> @}
+>> @}
+@end example
+
+This rule reflects 20th century practice for piano notation.  Its behavior is very
+similar to @code{modern} style, but here accidentals also get canceled
 across the staves in the same @internalsref{GrandStaff} or
 @internalsref{PianoStaff}.
 
+@lilypond[quote,ragged-right]
+musicA = {  << \relative {  cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
+       \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
+
+musicB = { \clef bass  \new Voice { \voiceTwo \relative { < fis, a cis>4 
+       \change Staff = up cis' \change Staff = down <fis, a>  
+       \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis 
+       <f a d>2 |  } }}
+
+\score { 
+       \new PianoStaff {
+       << \context Staff = "up" {
+              #(set-accidental-style 'piano) 
+       \musicA }
+       \context Staff = "down"{
+              #(set-accidental-style 'piano)
+       \musicB } >> }
+       \header { piece = \markup {\fill-line { \fontsize #3  "'piano" }}}
+}
+@end lilypond
+
 @item piano-cautionary
 @funindex #(set-accidental-style 'piano-cautionary)
 Same as @code{#(set-accidental-style 'piano)} but with the extra
 accidentals typeset as cautionaries.
 
+@lilypond[quote,ragged-right]
+musicA = {  << \relative {  cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
+       \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
+
+musicB = { \clef bass  \new Voice { \voiceTwo \relative { < fis, a cis>4 
+       \change Staff = up cis' \change Staff = down <fis, a>  
+       \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis 
+       <f a d>2 |  } }}
+
+\score { 
+       \new PianoStaff {
+       << \context Staff = "up" {
+              #(set-accidental-style 'piano-cautionary) 
+       \musicA }
+       \context Staff = "down"{
+              #(set-accidental-style 'piano-cautionary)
+       \musicB } >> }
+       \header { piece = \markup {\fill-line { \fontsize #3  "'piano-cautionary" }}}
+}
+@end lilypond
+
 @item no-reset
 @funindex no-reset accidental style
 This is the same as @code{default} but with accidentals lasting
-@q{forever} and not only until the next measure
-@lilypond[quote,ragged-right,fragment,verbatim,relative=1]
-#(set-accidental-style 'no-reset)
-c1 cis cis c
+@q{forever} and not only until the next measure:
+@lilypond[quote,ragged-right]
+musicA = {  << \relative {  cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
+       \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
+
+musicB = { \clef bass  \new Voice { \voiceTwo \relative { < fis, a cis>4 
+       \change Staff = up cis' \change Staff = down <fis, a>  
+       \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis 
+       <f a d>2 |  } }}
+
+\score { 
+       \new PianoStaff {
+       << \context Staff = "up" {
+              #(set-accidental-style 'no-reset) 
+       \musicA }
+       \context Staff = "down"{
+              #(set-accidental-style 'no-reset)
+       \musicB } >> }
+       \header { piece = \markup {\fill-line { \fontsize #3  "'no-reset" }}}
+}
 @end lilypond
 
 @item forget
@@ -204,9 +406,25 @@ are not remembered at all -- and hence all accidentals are
 typeset relative to the key signature, regardless of what was
 before in the music
 
-@lilypond[quote,ragged-right,fragment,verbatim,relative=1]
-#(set-accidental-style 'forget)
-\key d\major c4 c cis cis d d dis dis
+@lilypond[quote,ragged-right]
+musicA = {  << \relative {  cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
+       \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
+
+musicB = { \clef bass  \new Voice { \voiceTwo \relative { < fis, a cis>4 
+       \change Staff = up cis' \change Staff = down <fis, a>  
+       \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis 
+       <f a d>2 |  } }}
+
+\score { 
+       \new PianoStaff {
+       << \context Staff = "up" {
+              #(set-accidental-style 'forget) 
+       \musicA }
+       \context Staff = "down"{
+              #(set-accidental-style 'forget)
+       \musicB } >> }
+       \header { piece = \markup {\fill-line { \fontsize #3  "'forget" }}}
+}
 @end lilypond
 @end table
 
@@ -214,7 +432,7 @@ before in the music
 @seealso
 
 Program reference: @internalsref{Accidental_engraver},
-@internalsref{Accidental}, and @internalsref{AccidentalPlacement}.
+@internalsref{Accidental}, @internalsref{AccidentalSuggestion} and @internalsref{AccidentalPlacement}.
 
 
 @refbugs
@@ -437,6 +655,7 @@ This section describes what contexts are, and how to modify them.
 * Changing context default settings::  
 * Defining new contexts::       
 * Aligning contexts::           
+* Vertical grouping of grobs::  
 @end menu
 
 
@@ -889,7 +1108,7 @@ Here @var{name} is the name of a graphical object, like @code{Stem} or
 @code{NoteHead}, and @var{property} is an internal variable of the
 formatting system (@q{grob property} or @q{layout property}).  The latter is a
 symbol, so it must be quoted.  The subsection @ref{Constructing a
-tweak} explains what to fill in for @var{name}, @var{property}, and
+tweak}, explains what to fill in for @var{name}, @var{property}, and
 @var{value}.  Here we only discuss the functionality of this command.
 
 The command
@@ -1040,7 +1259,7 @@ them to a @code{\context} definition by referring to that variable.
 The @code{\RemoveEmptyStaffContext} will overwrite your current
 @code{\Staff} settings.  If you wish to change the defaults for a
 staff which uses @code{\RemoveEmptyStaffContext}, you must do so
-after calling @code{\RemoveemptyStaffContext}, ie
+after calling @code{\RemoveEmptyStaffContext}, ie
 
 @example
 \layout @{
@@ -1240,6 +1459,16 @@ ossia = { f4 f f f }
 @end lilypond
 
 
+@node Vertical grouping of grobs
+@subsection Vertical grouping of grobs
+
+The VerticalAlignment and VerticalAxisGroup grobs work together.
+VerticalAxisGroup groups together different grobs like Staff, Lyrics,
+etc. VerticalAlignment then vertically aligns the different grobs
+grouped together by VerticalAxisGroup. There is usually only one
+VerticalAlignment per score but every Staff, Lyrics, etc. has its own
+VerticalAxisGroup. 
+
 
 @node The \override command
 @section The @code{\override} command
@@ -1263,7 +1492,7 @@ which is a member of the @var{context}, to the @var{value}.
 * Determining the grob property::  
 * Objects connected to the input::  
 * Using Scheme code instead of \tweak::  
-* \set versus \override::          
+* \set versus \override::       
 * Difficult tweaks::            
 @end menu
 
@@ -1617,7 +1846,7 @@ without mentioning the grob name or context where this should be
 applied.
 
 This technique only works for objects that are directly connected to
-an @internalsref{event} from the input, for example
+an @internalsref{Event} from the input, for example
 
 @itemize @bullet
 @item note heads, caused by chord-pitch (i.e., notes inside a chord)
@@ -1637,7 +1866,7 @@ to output, so
 @end example
 
 @noindent
-does not change color.  See @ref{Displaying music expressions} for
+does not change color.  See @ref{Displaying music expressions}, for
 details.
 
 
@@ -1809,16 +2038,20 @@ one.  For example, if using this with @code{Hairpin},
 
 
 @item Some objects cannot be changed with @code{\override} for
-technical reasons. Examples of those are @code{NonMusicalPaperColumn}
+technical reasons.  Examples of those are @code{NonMusicalPaperColumn}
 and @code{PaperColumn}.  They can be changed with the
-@code{\outputProperty} function, which works similar to @code{\once
-\override}, but uses a different syntax,
+@code{\overrideProperty} function, which works similar to @code{\once
+\override}, but uses a different syntax.
 
 @example
-\outputProperty
+\overrideProperty
 #"Score.NonMusicalPaperColumn"  % Grob name
 #'line-break-system-details     % Property name
 #'((next-padding . 20))         % Value
 @end example
 
+Note, however, that @code{\override}, applied to
+@code{NoteMusicalPaperColumn} and @code{PaperColumn}, still works as
+expected within @code{\context} blocks.
+
 @end itemize