]> git.donarmstrong.com Git - lilypond.git/commitdiff
* Documentation/user/changing-defaults.itely (Page layout): new node.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 13 Jun 2004 13:23:32 +0000 (13:23 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 13 Jun 2004 13:23:32 +0000 (13:23 +0000)
(Paper size): rename node
(Page breaking): new node.
(Titling): move from invoking.

* lily/parser.yy (score_body): allow \header and music anywhere in
\score body.

ChangeLog
Documentation/user/changing-defaults.itely
Documentation/user/invoking.itexi
lily/parser.yy

index ed7d3b2a5d5fc45f104c5bdefca9e5638448cebf..7424d6d0e5cb15338536495afc61e25642602f2e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-06-13  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * Documentation/user/changing-defaults.itely (Page layout): new node.
+       (Paper size): rename node
+       (Page breaking): new node.
+       (Titling): move from invoking.
+
+       * lily/parser.yy (score_body): allow \header and music anywhere in
+       \score body.
+
 2004-06-13  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * scm/lily.scm (ly:load): Remove page-breaking.scm.
index e12f4408b6766e355434ab53ce054fccd12c71d1..074fa23525d8c995e2fdace40758400e5f563b6c 100644 (file)
@@ -1268,7 +1268,7 @@ them are not user-serviceable (``Internal properties''), but others
 are.
 
 We have been talking of `the' @code{Fingering} object, but actually it
-does  not amount to much. The initialization file
+does not amount to much. The initialization file
 @file{scm/define-grobs.scm} shows the soul of the `object',
 
 @verbatim
@@ -1407,6 +1407,7 @@ One of the uses of @code{fontSize} is to get smaller symbols for cue
 notes. An elaborate example of those is in
 @inputfileref{input/test,cue-notes.ly}.
 
+@cindex cue notes
 @cindex @code{font-style}
 
 @refcommands
@@ -1946,9 +1947,8 @@ This makes the following 28 measures (assuming 4/4 time) be broken every
 
 Internals: @internalsref{BreakEvent}.
 
-
-@node Page layout
-@subsection Page layout
+@node Line length and line breaking
+@subsection Line length and line breaking
 
 @cindex page breaks
 @cindex breaking pages
@@ -1974,131 +1974,180 @@ only affects the last line of the piece. No restrictions are put on
 that line. The result is similar to formatting paragraphs. In a
 paragraph, the last line simply takes its natural length.
 
-The page layout process happens outside the LilyPond formatting
-engine: variables controlling page layout are passed to the output,
-and are further interpreted by @code{lilypond} wrapper program. It
-responds to the following variables in the @code{\paper} block.  The
-spacing between systems is controlled with @code{interscoreline}, its
-default is 16pt.  The distance between the score lines will stretch in
-order to fill the full page @code{interscorelinefill} is set to a
-positive number.  In that case @code{interscoreline} specifies the
-minimum spacing.
-
-@cindex @code{textheight}
-@cindex @code{interscoreline}
-@cindex @code{interscorelinefill}
-
-If the variable @code{lastpagefill} is defined,
-@c fixme: this should only be done if lastpagefill= #t 
-systems are evenly distributed vertically on the last page.  This
-might produce ugly results in case there are not enough systems on the
-last page.  The @command{lilypond-book} command ignores
-@code{lastpagefill}.  See @ref{lilypond-book manual} for more
-information.
-
-@cindex @code{lastpagefill}
-
-Page breaks are normally computed by @TeX{}, so they are not under
-direct control of LilyPond.  However, you can insert commands into
-the @file{.tex} output to instruct @TeX{} where to break pages.  This
-is done by setting the @code{between-systems-strings} on the
-@internalsref{NonMusicalPaperColumn} where the system is broken.
-An example is shown in @inputfileref{input/regression,between-systems.ly}.
-The predefined command @code{\newpage} also does this.
 
-@cindex paper size
-@cindex page size
-@cindex @code{papersize}
+@node Titling
+@subsection Titling
 
-To change the paper size, there are two commands,
-@example
-        #(set-default-paper-size "a4")
-        \paper@{
-           #(set-paper-size "a4")
-        @}
-@end example
-The second one sets the size of the @code{\paper} block that it's in.
+Titles are created for each @code{\score} block, and over a
+@code{\book}.
 
-@refcommands
+The contents of the titles are taken from the @code{\header} blocks.
+The header block for a book supports the following 
+@table @code
+@item title
+    The title of the music. Centered on top of the first page.
+@item subtitle
+    Subtitle, centered below the title.
+@item poet
+    Name of the poet, left flushed below the subtitle.
+@item composer
+    Name of the composer, right flushed below the subtitle.
+@item meter
+    Meter string, left flushed below the poet.
+@item opus
+    Name of the opus, right flushed below the composer.
+@item arranger
+    Name of the arranger, right flushed below the opus.
+@item instrument
+    Name of the instrument, centered below the arranger.
+@item dedication            
+    To whom the piece is dedicated.
+@item piece
+    Name of the piece, left flushed below the instrument.
+@end table
 
-@cindex @code{\newpage}
-@code{\newpage}. 
+This is a demonstration of the fields available, 
 
+@lilypond
+\book {
+  \header {
+    title = "Title"
+    subtitle = "(and (the) subtitle)"
+    subsubtitle = "Sub sub title"
+    poet = "Poet"
+    composer = "Composer"
+    texttranslator = "Text Translator"
+    meter = "Meter"
+    arranger = "Arranger"
+    instrument = "Instrument"
+    piece = "Piece"
+  }
+  \score {
+    \header {
+      piece = "piece"
+      opus = "opus" 
+    }
+    { c'1 }
+  }
+}
+@end lilypond
 
-@seealso
+Different fonts may be selected for each element, by using a
+@code{\markup}, e.g.
 
-In this manual: @ref{Invoking lilypond}.
+@verbatim
+  \header {
+    title = \markup { \italic { The italic title } }
+  }
+@end verbatim
 
-Examples: @inputfileref{input/regression,between-systems.ly}.
+A more advanced option is to change the Scheme functions
+@code{make-book-title} and @code{make-score-title} functions, defined
+in the @code{\bookpaper} of the @code{\book} block. These functions
+create a block of titling, given the information in the
+@code{\header}. The init file @file{ly/titling.scm} shows how the
+default format is created, and it may be used as a template for
+different styles.
 
-Internals: @internalsref{NonMusicalPaperColumn}.
 
-@refbugs
+@cindex header
+@cindex footer
+@cindex page layout
+@cindex titles
 
-LilyPond has no concept of page layout, which makes it difficult to
-reliably choose page breaks in longer pieces.
 
 
 
+@node Page breaking
+@subsection Page breaking
 
-@node Output details
-@section Output details
+The default page breaking may be overriden by inserting
+@code{\pageBreak} or @code{\noPageBreak} commands. These commands are
+analogous to @code{\break} and @code{\noBreak}. They should be
+inserted with a bar line. These commands force and forbid a page-break
+from happening. 
 
-The default output format is La@TeX{}, which should be run
-through La@TeX{}.  Using the option @option{-f}
-(or @option{--format}) other output formats can be selected also, but
- none of them work reliably.
+Page breaks are computed by the @code{page-breaking} function in the
+@code{\bookpaper} block. 
 
-Now the music is output system by system (a `system' is a single line
-from the score, consisting of staves belonging together).  From
-@TeX{}'s point of view, a system is an @code{\hbox} which contains a
-lowered @code{\vbox} so that it is centered vertically on the baseline
-of the text.  Between systems, @code{\interscoreline} is inserted
-vertically to have stretchable space.  The horizontal dimension of the
-@code{\hbox} is given by the @code{linewidth} parameter from
-LilyPond's @code{\paper} block.
+@refcommands
+
+@cindex @code{\pageBreak}
+@code{\pageBreak}
+@cindex  @code{\noPageBreak} 
+@code{\noPageBreak} 
 
-After the last system LilyPond emits a stronger variant of
-@code{\interscoreline} only if the macro
-@code{\lilypondpaperlastpagefill} is not defined (flushing the systems
-to the top of the page).  You can avoid that by setting the variable
-@code{lastpagefill} in LilyPond's @code{\paper} block.
+@node Paper size
+@subsection Paper size
 
-@c FIXME: broken by page layout
-It is possible to fine-tune the vertical offset further by defining the
-macro @code{\lilypondscoreshift}:
+@cindex paper size
+@cindex page size
+@cindex @code{papersize}
 
+To change the paper size, there are two commands,
 @example
-\def\lilypondscoreshift@{0.25\baselineskip@}
+        #(set-default-paper-size "a4")
+        \paper@{
+           #(set-paper-size "a4")
+        @}
 @end example
+The second one sets the size of the @code{\paper} block that it is in.
 
-@noindent
-where @code{\baselineskip} is the distance from one text line to the next.
 
-Here an example how to embed a small LilyPond file @code{foo.ly} into
-running La@TeX{} text without using the @code{lilypond-book} script
-(@pxref{lilypond-book manual}):
+@node Page layout
+@subsection Page layout
 
-@example
-\documentclass@{article@}
+@cindex page layout
+@cindex margins
+@cindex header, page
+@cindex footer, page
 
-\def\lilypondpaperlastpagefill@{@}
-\lineskip 5pt
-\def\lilypondscoreshift@{0.25\baselineskip@}
+LilyPond will do page layout, setting margins and adding headers and
+footers to each page.
 
-\begin@{document@}
-This is running text which includes an example music file
-\input@{foo.tex@}
-right here.
-\end@{document@}
-@end example
+The default layout responds to the following settings in the
+@code{\bookpaper} block
 
-The file @file{foo.tex} has been simply produced with
+@table @code
+@item hsize
+ The width of the page
+@item vsize
+ The height of the page
+@item top-margin
+ Margin between header and top of the page
+@item bottom-margin
+ Margin between footer and bottom of the page
+@item head-sep
+ Distance between top-most music system and the page header
+@item foot-sep
+ Distance between bottom-most music system and the page footer
+@end itemize
+
+The default page header puts the page number and the @code{instrument}
+field from the @code{\header} block on a line.
+
+@cindex copyright
+@cindex tagline
+
+The default footer is empty, except for the first page, where it the
+@code{copyright} field from @code{\header} is inserted, and the last
+page, where  @code{tagline} from  @code{\header} is added (the default
+tagline is ``Engraved by LilyPond (@var{version})''.
+
+The header and footer are created by the functions @code{make-footer}
+and @code{make-header}, defined in @code{\bookpaper}. The default
+implementations are in @file{scm/page-layout.scm}.
+
+The page layout itself is done by two functions:
+@code{page-music-height} and @code{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. 
+
+
+@seealso
+
+Examples: TODO
 
-@example
-  lilypond-bin foo.ly
-@end example
 
-The call to @code{\lineskip} assures that there is enough vertical space
-between the LilyPond box and the surrounding text lines.
 
index 459bea18ff7cab1277a0f6bf34f26dc70d9eded8..dcdcdfe74c133f42835d26f604c12822517c80e3 100644 (file)
@@ -86,55 +86,6 @@ Show the warranty with which GNU LilyPond comes. (It comes with
 @strong{NO WARRANTY}!)
 @end table
 
-@subsection Titling layout
-
-@code{lilypond} extracts the following header fields from the LY files
-to generate titling; an example demonstrating all these fields is in
-@inputfileref{input/test,lilypond-testpage.ly}:
-
-@table @code
-@item title
-    The title of the music. Centered on top of the first page.
-@item subtitle
-    Subtitle, centered below the title.
-@item poet
-    Name of the poet, left flushed below the subtitle.
-@item composer
-    Name of the composer, right flushed below the subtitle.
-@item meter
-    Meter string, left flushed below the poet.
-@item opus
-    Name of the opus, right flushed below the composer.
-@item arranger
-    Name of the arranger, right flushed below the opus.
-@item instrument
-    Name of the instrument, centered below the arranger.
-@item dedication            
-    To whom the piece is dedicated.
-@item piece
-    Name of the piece, left flushed below the instrument.
-@item head
-    A text to print in the header of all pages. It is not called
-@code{header}, because @code{\header} is a reserved word in LilyPond.
-@item copyright
-    A text to print in the footer of the first page. Default is to 
-    print the standard footer also on the first page. Note that if the
-    score consists of only a single page, the first page is also the
-    last page, and in this case, the tagline is printed instead of the
-    copyright.
-@item footer
-    A text to print in the footer of all but the last page.
-@item tagline
-    Line to print at the bottom of last page. The default text is ``Engraved
-by LilyPond @var{version-number}''.
-@end table
-
-
-@cindex header
-@cindex footer
-@cindex page layout
-@cindex titles
-
 
 
 @subsection Additional parameters
index f5ebfa291c1652043a84076e73ef080fb482fb0d..3907d8b3ea1a2845ba0291ab4fd4ff4aa8289bf0 100644 (file)
@@ -667,25 +667,31 @@ score_block:
        ;
 
 score_body:
-       Music   {
+       /**/    {
                $$ = new Score;
        
                $$->set_spot (THIS->here_input ());
-               SCM m = $1->self_scm ();
+       }
+       | SCORE_IDENTIFIER {
+               $$ = new Score ( *unsmob_score ($1));
+               $$->set_spot (THIS->here_input ());
+       }
+       | score_body Music {
+               SCM m = $2->self_scm ();
                scm_gc_unprotect_object (m);
-
+       
                /*
                        guh.
                */
                SCM check_funcs = ly_scheme_function ("toplevel-music-functions");
                for (; ly_c_pair_p (check_funcs); check_funcs = ly_cdr (check_funcs))
                        m = scm_call_1 (ly_car (check_funcs), m);
+               if (unsmob_music ($$->music_))
+               {
+                       THIS->parser_error (_("Already have music in score"));
+                       unsmob_music ($$->music_)->origin ()->error (_("This is the previous music"));
+               }
                $$->music_ = m;
-
-       }
-       | SCORE_IDENTIFIER {
-               $$ = new Score ( *unsmob_score ($1));
-               $$->set_spot (THIS->here_input ());
        }
        | score_body lilypond_header    {
                $$->header_ = $2;