]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/notation/input.itely
Fixes black bars in NR
[lilypond.git] / Documentation / notation / input.itely
index 9ec2b19b793c80a9079ae4e24dda8da1cf991723..fe0af3b5daf4aaddcf320def4da0602a2dfaaea9 100644 (file)
@@ -8,7 +8,7 @@
     Guide, node Updating translation committishes..
 @end ignore
 
-@c \version "2.15.25"
+@c \version "2.15.39"
 
 @node General input and output
 @chapter General input and output
@@ -353,9 +353,11 @@ toplevel expression is one of the following:
 @item
 An output definition, such as @code{\paper}, @code{\midi}, and
 @code{\layout}.  Such a definition at the toplevel changes the default
-book-wide settings.  If more than one such definition of
-the same type is entered at the top level any definitions in the later
-expressions have precedence.
+book-wide settings.  If more than one such definition of the same type
+is entered at the top level the definitions are combined, but in
+conflicting situations the later definitions take precedence.  For
+details of how this affects the @code{\layout} block see
+@ref{The \layout block}.
 
 @item
 A direct scheme expression, such as
@@ -504,11 +506,13 @@ after the entire command.
 
 @end itemize
 
-
 @seealso
 Learning Manual:
 @rlearning{How LilyPond input files work}.
 
+Notation Reference:
+@ref{The \layout block}.
+
 
 @node Titles and headers
 @section Titles and headers
@@ -711,6 +715,7 @@ Notation Reference:
 Installed Files:
 @file{ly/titling-init.ly}.
 
+
 @node Default layout of headers and footers
 @unnumberedsubsubsec Default layout of headers and footers
 
@@ -981,6 +986,49 @@ variables:
 @item @code{evenFooterMarkup}
 @end itemize
 
+@cindex markup, conditional
+@cindex on-the-fly
+@funindex \on-the-fly
+
+The @code{\markup} command @code{\on-the-fly} can be used to add
+markup conditionally to header and footer text defined within the
+@code{\paper} block, using the following syntax:
+
+@example
+@code{variable} = @code{\markup} @{
+  ...
+  @code{\on-the-fly}  #@var{procedure}  @var{markup}
+  ...
+@}
+@end example
+
+The @var{procedure} is called each time the @code{\markup} command
+in which it appears is evaluated.  The @var{procedure} should test
+for a particular condition and interpret (i.e. print) the
+@var{markup} argument if and only if the condition is true.
+
+A number of ready-made procedures for testing various conditions are
+provided:
+
+@quotation
+@multitable {print-page-number-check-first-----} {should this page be printed-----}
+
+@headitem  Procedure name           @tab  Condition tested
+
+@item print-page-number-check-first @tab  should this page number be printed?
+@item create-page-number-stencil    @tab  'print-page-numbers true?
+@item print-all-headers             @tab  'print-all-headers true?
+@item first-page                    @tab  first page in the book?
+@item (on-page nmbr)                @tab  page number = nmbr?
+@item last-page                     @tab  last page in the book?
+@item not-first-page                @tab  not first page in the book?
+@item part-first-page               @tab  first page in the book part?
+@item part-last-page                @tab  last page in the book part?
+@item not-single-page               @tab  pages in book part > 1?
+
+@end multitable
+@end quotation
+
 The following example centers page numbers at the bottom of every
 page.  First, the default settings for @code{oddHeaderMarkup} and
 @code{evenHeaderMarkup} are removed by defining each as a @emph{null}
@@ -1009,11 +1057,26 @@ same layout by defining it as @code{\oddFooterMarkup}:
 }
 @end lilypond
 
+Several @code{\on-the-fly} conditions can be combined with an
+@q{and} operation, for example,
+
+@example
+  @code{\on-the-fly #first-page}
+  @code{\on-the-fly #last-page}
+  @code{@{ \markup ... \fromproperty #'header: ... @}}
+@end example
+
+determines if the output is a single page.
+
 @seealso
 Notation Reference:
 @ref{Title blocks explained},
 @ref{Default layout of book and score title blocks}.
 
+Installed Files:
+@file{../ly/titling-init.ly}.
+
+
 @node Creating footnotes
 @subsection Creating footnotes
 
@@ -1029,56 +1092,89 @@ footnotes and manual footnotes.
 @node Footnotes overview
 @unnumberedsubsubsec Footnotes overview
 
-Automatic footnotes create incrementing, numerical indicators and
-manual footnotes allow a custom indicator to be created instead.  All
-grobs, top-level @code{\markup} and chorded notes can be annotated.
+Automatic footnotes create incrementing numerical indicators and manual
+footnotes allow a custom indicator to be created instead.  Footnotes are
+normally applied like @code{\tweak} and consequently can be placed
+directly on grobs (graphical objects) created by most music elements and
+post-events.  In cases where this does not work (like with bar lines and
+meter changes, where the grobs are produced as a consequence of property
+changes), footnotes can also be specified as a standalone music event
+affecting all grobs of a given type at a particular time step.
+
+The full form of a footnote command is
 
-The order in which each grob is drawn determines the order in which each
-indicator and so footnotes are created during compilation.
+@example
+\footnote @var{mark} @var{offset} @var{grob-name} @var{footnote}
+@var{music}
+@end example
 
+The elements are as follows:
+
+@table @var
+@item mark
+is a markup or string specifying the footnote mark which is used for
+both marking the reference point as well as the footnote itself at the
+bottom of the page.  It can be omitted (or equivalently replaced with
+@code{\default}) in which case a number in sequence will be generated.
+@item offset
+is a number pair such as @samp{#(2 . 1)} specifying the X and Y offset
+from the reference point where the mark will be placed.
+@item grob-name
+specifies a type of grob to mark (like @samp{#'Flag}).  If it is given,
+the respective grob will be used as a reference point even in case that
+its @q{cause} is not the referenced @var{music} itself but a grob
+created from it.  It can be omitted (or replaced with @code{\default}),
+and then only a directly created grob will be annotated.
+@item footnote
+This markup or string specifies the footnote text to use at the bottom
+of the page.
+@item music
+This is the item, a music event or chord constituent or post-event, that
+is being annotated.  While it cannot be omitted, it @emph{can} be
+replaced by @code{\default} in which case the footnote is not attached
+to a music expression in particular, but rather to a moment of time.  It
+is mandatory in this case to use the @var{grob-name} argument for
+selecting an affected grob type, like @samp{#'TimeSignature}.
+@end table
+
+Like with @code{\tweak}, if your @code{\footnote} is applied to a
+post-event or articulation, it will itself have to be preceded with
+@code{-} to make the parser attach the result to the preceding note or
+rest.
 
 @node Automatic footnotes
 @unnumberedsubsubsec Automatic footnotes
 
-Of the two commands used to create automatic footnotes, use
-@code{\footnoteGrob} for individual grobs (i.e. note heads, stems,
-slurs, dynamics and @code{\markup} when using @code{TextScripts});
-and @code{\footnote} for annotating chorded notes.
-
-Both commands take three arguments; the @var{Layout Object} to be
-annotated, the @var{(x . y)} position of the indicator and a
-@code{\markup} that will appear in the footnote at the bottom of the
-page.
-
-The command @code{\footnoteGrob} must come @emph{before} the grob
-that the footnote is being attached to:
+Automatic footnotes take four arguments: the @samp{(x . y)} position of
+the indicator, the optional @var{grob-name} specifying the layout object
+to be annotated, the @var{footnote} markup itself that will appear at
+the bottom of the page, and of course the @var{music} to attach the
+footnote to.
 
 @lilypond[verbatim,quote,ragged-right,papersize=a8]
 \book {
   \header { tagline = ##f }
   \relative c' {
-    \footnote #'(0.5 . -2) #'NoteHead
+    \footnote #'(0.5 . -2)
       \markup { The first note }
     a'4 b8
-    \footnote #'(0.5 . 1) #'NoteHead
+    \footnote #'(0.5 . 1) #'Flag
       \markup { The third note }
-    e c4 d4
+    e\noBeam c4 d4
   }
 }
 @end lilypond
 
-To annotate chorded notes, the @code{\footnote} must come
-@emph{after} the note to which the footnote is being attached as a
-@code{TextScript}:
+Chorded notes pose no particular difficulty:
 
 @lilypond[verbatim,quote,ragged-right,papersize=a8]
 \book {
   \header { tagline = ##f }
   \relative c' {
     <
-    c-\footnote #'(1 . -1.25) "Here is a C"
-    es-\footnote #'(2 . -0.25) \markup { \italic "An E-flat" }
-    g-\footnote #'(2 . 3) \markup { \bold "This is a G" }
+    \footnote #'(1 . -1.25) "Here is a C" c
+    \footnote #'(2 . -0.25) \markup { \italic "An E-flat" } es
+    \footnote #'(2 . 3) \markup { \bold "This is a G" } g
     >1
   }
 }
@@ -1088,34 +1184,24 @@ To annotate chorded notes, the @code{\footnote} must come
 are printed in order of descendancy; the higher the footnote, the
 higher up in the list.}
 
-Here are some examples of automatically footnoted grobs, also showing
-the relative position of the footnotes to the tagline and copyright.
+Here are some more examples of footnoted grobs, also showing the
+relative position of the footnotes to the tagline and copyright.
 
 @lilypond[verbatim,quote,ragged-right,papersize=a8]
 \book {
   \header { copyright = \markup { "Copyright 1970" } }
   \relative c' {
-    \footnote #'(-3 . 0) #'DynamicText
-      \markup { \bold Forte }
-
-    \footnote #'(0 . 1.5) #'Slur
-      \markup { A slur }
-    a'4\f(
-
-    \footnote #'(0 . -2) #'Beam
-      \markup { Beam }
-    b8)[ e]
-
+    a'4-\footnote #'(-3 . 0) \markup { \bold Forte } \f
+    -\footnote #'(0 . 1.5) \markup { A slur } (
+    b8)-\footnote #'(0 . -2) \markup { Beam } [ e]
     \footnote #'(1 . -1) #'Stem
       \markup  { \teeny { This is a stem } }
     c4
-
     \footnote #'(0 . 0.5) #'AccidentalCautionary
       \markup \italic { A cautionary accidental }
-
-    \footnote #'(0.5 . -0.5) #'TextScript
-      \markup \italic { Slow Down }
-    dis?4_"rit."
+    \footnote #'(1 . 1) "The note itself"
+    dis?4-\footnote #'(0.5 . -0.5) \markup \italic { Slow Down }
+         _"rit."
   }
 }
 @end lilypond
@@ -1137,51 +1223,48 @@ required:
 @node Manual footnotes
 @unnumberedsubsubsec Manual footnotes
 
-@funindex \footnote
-@funindex \footnoteGrob
 @cindex footnotes, manual
 
-There are two commands used to create manual footnotes; @code{\footnote}
-for top-level @code{\markup} and chorded notes; and @code{\footnoteGrob}
-for individual grobs (and @code{\markup} when using @code{TextScripts}).
+Manually marked footnotes take an additional first markup argument
+@var{mark} for making the reference mark.  In contrast to automatically
+generated footnote marks, they will not appear before the @var{footnote}
+markup at the bottom of the page: establishing the visual connection is
+left to the user.  LilyPond will only make sure that the corresponding
+markup appears on the bottom of the same page.
 
-When annotating grobs, the @code{\footnote} command takes four
-arguments; the @var{Layout Object} to be annotated, the @var{(x . y)}
-position of the indicator and two @code{\markup} commands; the first is
-the indicator attached to the note or grob and the second is the
-footnote at the bottom of the page.
-
-The command @code{\footnoteGrob} must come @emph{after} the grob that
-the footnote is annotating and attached as a @code{TextScript}:
+Other than that, the use is identical to that of automatically numbered
+footnotes.
 
 @lilypond[verbatim,quote,ragged-right,papersize=a8]
 \book {
   \header { tagline = ##f }
   \relative c' {
-    a'4-\footnote
-          "1" #'(0.5 . -2) #'NoteHead \markup { \italic "1. The first note" }
+    \footnote
+          "1" #'(0.5 . -2)
+          \markup { \italic "1. The first note" }
+    a'4
     b8
-    e-\footnote
-          \markup { \bold "2" } #'(0.5 . 1) #'NoteHead "2. The second note"
+    \footnote
+          \markup { \bold "2" } #'(0.5 . 1)
+          "2. The second note"
+    e
     c4
-    d\p-\footnote "3" #'(0.5 . -1) #'DynamicText "3. Piano"
+    d-\footnote "3" #'(0.5 . -1) "3. Piano" \p
   }
 }
 @end lilypond
 
-To annotate chorded notes, the @code{\footnote} must come @emph{after}
-the note that the footnote is annotating and attached as a
-@code{TextScript}:
+To annotate chorded notes with manual footnotes:
 
 @lilypond[verbatim,quote,ragged-right,papersize=a8]
 \book {
   \header { tagline = ##f }
   \relative c' {
     <
-    c-\footnote "1" #'(1 . -1.25) "1. C"
-    es-\footnote
-       \markup { \bold "b" } #'(2 . -0.25) "b. E-flat"
-    g-\footnote "3" #'(2 . 3) \markup { \italic "iii. G" }
+    \footnote "1" #'(1 . -1.25) "1. C" c
+    \footnote
+       \markup { \bold "b" } #'(2 . -0.25) "b. E-flat" es
+    \footnote "3" #'(2 . 3) \markup { \italic "iii. G" } g
     >1
   }
 }
@@ -1198,38 +1281,31 @@ the relative position of the footnotes to the tagline and copyright
 \book {
   \header { tagline = ##f }
   \relative c' {
-    \footnote
-      \markup { \teeny 1 } #'(-3 . 0) #'DynamicText
-      \markup { 1. \bold Forte }
-
-    \footnote
-      \markup { \teeny b } #'(0 . 1.5) #'Slur
-      \markup { b. A slur }
-    a'4\f(
-
-    \footnote
-      \markup { \teeny 3 } #'(0 . -2) #'Beam
-      \markup { 3. Beam }
-    b8)[ e]
-
+    a'4-\footnote
+      \markup { \teeny 1 } #'(-3 . 0)
+      \markup { 1. \bold Forte } \f
+    -\footnote
+      \markup { \teeny b } #'(0 . 1.5)
+      \markup { b. A slur } (
+    b8)-\footnote
+      \markup { \teeny 3 } #'(0 . -2)
+      \markup { 3. Beam } [
+    e]
     \footnote
       \markup { 4 } #'(1 . -1) #'Stem
       \markup  { \bold 4. { This is a stem } }
     c4
-
     \footnote
-      \markup \concat \teeny { "sharp (v)" } #'(0 . 0.5) #'AccidentalCautionary
+      \markup \concat \teeny { "sharp (v)" }
+          #'(0 . 0.5) #'AccidentalCautionary
       \markup \italic { v. A cautionary accidental }
-
+    dis?4-\footnote
+      \markup \concat \teeny { "a" } #'(0.5 . -0.5)
+      \markup \italic { a. Slow Down } _"rit."
     \footnote
-      \markup \concat \teeny { "a" } #'(0.5 . -0.5) #'TextScript
-      \markup \italic { a. Slow Down }
-    dis?4_"rit."
-
-    \breathe
-    \footnote
-      \markup { \teeny \musicglyph #"rests.4" } #'(1.5 . -0.25) #'BreathingSign
-      \markup { \null }
+      \markup { \teeny \musicglyph #"rests.4" }
+          #'(1.5 . -0.25)
+      \markup { \null } \breathe
   }
 }
 @end lilypond
@@ -1280,7 +1356,7 @@ command, either at top-level or inside music.  This label can then be
 referred to in a markup, to get the number of the page where the marked
 point is placed, using the @code{\page-ref} markup command.
 
-@lilypond[verbatim]
+@lilypond[verbatim,papersize=a8landscape]
 \header { tagline = ##f }
 \book {
   \label #'firstScore
@@ -1398,7 +1474,7 @@ tocAct =
    (add-toc-item! 'tocActMarkup text))
 @end verbatim
 
-@lilypond[line-width=11.0\cm]
+@lilypond[line-width=10.0\cm]
 \header { tagline = ##f }
 \paper {
   tocActMarkup = \markup \large \column {
@@ -1426,7 +1502,7 @@ tocAct =
 
 Dots can be added to fill the line between an item and its page number:
 
-@lilypond[verbatim,quote]
+@lilypond[verbatim,line-width=10.0\cm]
 \header { tagline = ##f }
 \paper {
   tocItemMarkup = \tocItemWithDotsMarkup
@@ -1440,10 +1516,9 @@ Dots can be added to fill the line between an item and its page number:
 }
 @end lilypond
 
-
 @seealso
-Init files: @file{../ly/toc-init.ly}.
-
+Installed Files:
+@file{ly/toc-init.ly}.
 
 @predefined
 @funindex \table-of-contents
@@ -1826,19 +1901,18 @@ Notation Reference:
 @ref{Automatic part combining},
 @ref{Including LilyPond files}.
 
-
 @ignore
 @c This warning is more general than this placement implies.
 @c Rests are not merged whether or not they come from tagged sections.
 @c Should be deleted?  -td
 
 @knownissues
-
 Multiple rests are not merged if you create a score with more
 than one tagged section at the same place.
 
 @end ignore
 
+
 @node Using global settings
 @unnumberedsubsubsec Using global settings
 
@@ -1866,6 +1940,7 @@ Learning Manual:
 Notation Reference:
 @ref{Including LilyPond files}.
 
+
 @node Special characters
 @subsection Special characters
 
@@ -2054,7 +2129,6 @@ Installed Files:
 @file{ly/text-replacements.ly}.
 
 
-
 @node Controlling output
 @section Controlling output
 
@@ -2158,8 +2232,8 @@ The default output formats for the printed score are Portable
 Document Format (PDF) and PostScript (PS).  Scalable Vector
 Graphics (SVG), Encapsulated PostScript (EPS) and Portable
 Network Graphics (PNG) output formats are also available through
-command line options, see @rprogram{Command line options for
-lilypond}.
+command line options, see
+@rprogram{Basic command line options for LilyPond}.
 
 
 @node Replacing the notation font
@@ -2191,7 +2265,8 @@ existing @code{fonts} directory to @code{fonts_orig} and the
 reverse the process.
 
 @seealso
-Learning Manual: @rlearning{Other sources of information}.
+Learning Manual:
+@rlearning{Other sources of information}.
 
 @knownissues
 Gonville cannot be used to typeset @q{Ancient Music} notation and it is
@@ -2218,7 +2293,7 @@ what was entered.  This is convenient for checking the music; octaves
 that are off or accidentals that were mistyped stand out very much
 when listening to the MIDI output.
 
-Standard MIDI oputput is somewhat crude; optionally, an enhanced and
+Standard MIDI output is somewhat crude; optionally, an enhanced and
 more realistic MIDI output is available by means of
 @ref{The Articulate script}.
 
@@ -2377,24 +2452,16 @@ indication to be printed:
 \score @{
   @var{...music...}
   \midi @{
-    \context @{
-      \Score
-      tempoWholesPerMinute = #(ly:make-moment 72 4)
-    @}
+    \tempo 4 = 72
   @}
 @}
 @end example
 
 In this example the tempo is set to 72 quarter note
-beats per minute.  This kind of tempo specification cannot take
-a dotted note length as an argument.  If one is required, break
-the dotted note into smaller units.  For example, a tempo of 90
-dotted quarter notes per minute can be specified as 270 eighth
-notes per minute:
-
-@example
-tempoWholesPerMinute = #(ly:make-moment 270 8)
-@end example
+beats per minute.  @code{\tempo} is actually a music command for
+setting properties during the interpretation of music: in the
+context of output definitions like a @code{\midi} block, as a matter of
+courtesy those are reinterpreted as if they were context modifications.
 
 @cindex MIDI context definitions
 
@@ -2641,9 +2708,9 @@ volume is limited to the range 0.2 - 0.5.
   >>
   \layout {}
   \midi {
+    \tempo 2 = 72
     \context {
       \Score
-      tempoWholesPerMinute = #(ly:make-moment 72 2)
       midiMinimumVolume = #0.2
       midiMaximumVolume = #0.5
     }
@@ -2693,10 +2760,7 @@ correctly.
   >>
   \layout {}
   \midi {
-    \context {
-      \Score
-      tempoWholesPerMinute = #(ly:make-moment 72 2)
-    }
+    \tempo 2 = 72
   }
 }
 @end lilypond
@@ -2762,10 +2826,7 @@ to the same values as the previous example.
   >>
   \layout { }
   \midi {
-    \context {
-      \Score
-      tempoWholesPerMinute = #(ly:make-moment 72 2)
-    }
+    \tempo 2 = 72
   }
 }
 @end lilypond