[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
improved TeX output
From: |
Werner LEMBERG |
Subject: |
improved TeX output |
Date: |
Sun, 15 Sep 2002 12:34:55 +0200 (CEST) |
Below my changes for improved TeX output (relative to CVS 2002-09-13,
15:34). I've added a new section `Output details' to the lilypond
manual to document it.
Enjoy!
Werner
======================================================================
2002-09-15 Werner Lemberg <address@hidden>
Improving LilyPond's output to make them ordinary TeX boxes with
predictable dimensions. System boxes are now vertically centered on
the baseline; this offset can be further controlled with
\lilypondscoreshift.
* lily/system.cc (System::post_processing): Pass length of current
system to `start-system' (including any horizontal indentation).
* scm/tex.scm, scm/pdftex.scm: Make output of various functions
prettier.
(lily-def): Append `%'.
(start-system): Add parameter `wd'. Output more TeX code to specify
box dimensions.
(stop-system, stop-last-system): Complement changes in
`start-system'.
* scm/sketch.scm, scm/ps.scm, scm/pdf.scm, scm/ascii-script.scm:
Updated.
* scripts/ly2dvi.py (global_latex_definition): Set \parindent to 0.
* buildscripts/mf-to-table.py (write_tex_defs): Append `%'.
Write final `\endinput'.
* tex/lily-ps-defs.tex, tex/lily-pdf-defs.tex,
tex/lilypond-plaintex.tex, tex/lilypond-latex.tex,
tex/lilyponddefs.tex, tex/titledefs.tex: Reformat code. Assure that
files and macro definitions don't produce spurious spaces and
paragraphs (using \endlinechar).
* tex/lilyponddefs.tex: New dimension `\scoreshift'.
* Documentation/user/internals.itely: Improved formatting, fixing
typos
Added a section `Output details' to describe how the TeX code
looks like.
======================================================================
--- ./Documentation/user/internals.itely.old Sun Aug 18 12:20:57 2002
+++ ./Documentation/user/internals.itely Sun Sep 15 12:08:38 2002
@@ -17,39 +17,41 @@
@c todo: moved from refman.
The purpose of LilyPond is explained informally by the term `music
-typesetter'. This is not a fully correct name: not only does the
+typesetter'. This is not a fully correct name: Not only does the
program print musical symbols, it also makes aesthetic decisions.
Symbols and their placements are @emph{generated} from a high-level
musical description. In other words, LilyPond would be best described
-by `music compiler' or `music to notation compiler'.
+to be a `music compiler' or `music to notation compiler'.
LilyPond is linked to GUILE, GNU's Scheme library for extension
-programming. The Scheme library provides the glue that holds together
+programming. The Scheme library provides the glue that holds together
the low-level routines and separate modules which are written in C++.
When lilypond is run to typeset sheet music, the following happens:
+
@itemize @bullet
address@hidden GUILE Initialization: various scheme files are read
address@hidden parsing: first standard @code{ly} initialization files are
read, and
address@hidden GUILE initialization: Various scheme files are read.
+
address@hidden Parsing: First standard @code{ly} initialization files are read,
then the user @file{ly} file is read.
address@hidden interpretation: the music in the file is processed ``in playing
-order'', i.e. the order that you use to read sheet music, or the
-order in which notes are played. The result of this step is a typesetting
-specification.
-
address@hidden typesetting:
-The typesetting specification is solved: positions and formatting is
-calculated.
address@hidden the visible results ("virtual ink") are written to the output
file.
address@hidden Interpretation: The music in the file is processed `in playing
+order', i.e., the order that you use to read sheet music, or the
+order in which notes are played. The result of this step is a
+typesetting specification.
+
address@hidden Typesetting: The typesetting specification is solved: positions
+and formatting is calculated.
+
address@hidden The visible results ("virtual ink") are written to the output
file.
@end itemize
During these stages different types of data play the the main role:
-during parsing, @strong{Music} objects are created. During the
+During parsing, @strong{Music} objects are created. During the
interpretation, @strong{contexts} are constructed, and with these
-contexts a network of @strong{graphical objects} (``grobs'') is
-created. These grobs contain unknown variables, and the network forms a
-set of equations. After solving the equations and filling in these
+contexts a network of @strong{graphical objects} (`grobs') is
+created. These grobs contain unknown variables, and the network forms a
+set of equations. After solving the equations and filling in these
variables, the printed output is written to an output file.
These threemanship of tasks (parsing, translating, typesetting) and
@@ -57,61 +59,56 @@
design of the program.
-
@table @b
address@hidden Parsing:
address@hidden Parsing
-The LY file is read, and converted to a list of @code{Scores}, which
-each contain @code{Music} and paper/midi-definitions. Here @code{Music},
address@hidden and @code{Duration} objects are created.
+The @code{ly} file is read and converted to a list of @code{Scores}, which
+each contain @code{Music} and paper/midi-definitions. Here @code{Music},
address@hidden, and @code{Duration} objects are created.
@item Interpreting music
@cindex interpreting music
-All music events are "read" in the same order as they would be played
-(or read from paper). At every step of the interpretation, musical
-events are delivered to
-interpretation contexts,
+All music events are `read' in the same order as they would be played
+(or read from paper). At every step of the interpretation, musical
+events are delivered to interpretation contexts,
@cindex engraver
-which use them to build @code{Grob}s (or MIDI objects, for MIDI output).
+which use them to build @code{Grob}s (or MIDI objects for MIDI output).
In this stage @code{Music_iterators} do a traversal of the @code{Music}
-structure. The music events thus encountered are reported to
+structure. The music events thus encountered are reported to
@code{Translator}s, a set of objects that collectively form interpretation
contexts.
-
@item Prebreaking
-
@cindex prebreaking
At places where line breaks may occur, clefs and bars are prepared for
a possible line break.
@item Preprocessing
-
@cindex preprocessing
In this stage, all information that is needed to determine line breaking
is computed.
address@hidden Break calculation:
address@hidden Break calculation
The lines and horizontal positions of the columns are determined.
@item Breaking
Relations between all grobs are modified to reflect line breaks: When a
-spanner, e.g. a slur, crosses a line-break, then the spanner is "broken
-into pieces", for every line that the spanner is in, a copy of the grob
-is made. A substitution process redirects all grob-reference so that
+spanner, e.g. a slur, crosses a line break, then the spanner is `broken
+into pieces'; for every line that the spanner is in, a copy of the grob
+is made. A substitution process redirects all grob references so that
each spanner grob will only reference other grobs in the same line.
address@hidden Outputting:
address@hidden Outputting
All vertical dimensions and spanning objects are computed, and all grobs
-are output, line by line. The output is encoded in the form of
+are output, line by line. The output is encoded in the form of
@code{Molecule}s
@end table
@@ -120,13 +117,13 @@
section.
-
@c FIXME: Note entry vs Music entry at top level menu is confusing.
@c . {Music entry}
@menu
* Interpretation context::
* Syntactic details::
* Lexical details::
+* Output details::
@end menu
@@ -145,35 +142,38 @@
Interpretation contexts are objects that only exist during a run of
LilyPond. During the interpretation phase of LilyPond (when it prints
-"interpreting music"), the music expression in a @code{\score} block is
-interpreted in time order. This is the same order that humans hear and
-play the music.
address@hidden music} to standard output), the music expression in
+a @code{\score} block is interpreted in time order. This is the same
+order that humans hear and play the music.
During this interpretation, the interpretation context holds the
-state for the current point within the music. It contains information
+state for the current point within the music. It contains information
like
@itemize @bullet
- @item What notes are playing at this point?
- @item What symbols will be printed at this point?
- @item What is the current key signature, time signature, point within
- the measure, etc.?
address@hidden What notes are playing at this point?
+
address@hidden What symbols will be printed at this point?
+
address@hidden What is the current key signature, time signature, point within
+the measure, etc.?
@end itemize
Contexts are grouped hierarchically: A @internalsref{Voice} context is
contained in a @internalsref{Staff} context (because a staff can contain
multiple voices at any point), a @internalsref{Staff} context is contained in
address@hidden, @internalsref{StaffGroup}, or @internalsref{ChoirStaff} context.
address@hidden, @internalsref{StaffGroup}, or
address@hidden context.
Contexts associated with sheet music output are called @emph{notation
contexts}, those for sound output are called @emph{performance
-contexts}. The default definitions of the standard notation and
+contexts}. The default definitions of the standard notation and
performance contexts can be found in @file{ly/engraver-init.ly} and
@file{ly/performer-init.ly}, respectively.
+
@node Creating contexts
@subsection Creating contexts
-
@cindex @code{\context}
@cindex context selection
@@ -181,11 +181,12 @@
following music expression.
@example
- \context @var{contexttype} [= @var{contextname}] @var{musicexpr}
+\context @var{contexttype} [= @var{contextname}] @var{musicexpr}
@end example
address@hidden
This instructs lilypond to interpret @var{musicexpr} within the context
- of type @var{contexttype} and with name @var{contextname}. If this
+of type @var{contexttype} and with name @var{contextname}. If this
context does not exist, it will be created.
@lilypond[verbatim,singleline]
@@ -194,9 +195,9 @@
c4 <d4 \context Staff = "another" e4> f
}
}
-
@end lilypond
address@hidden
In this example, the @code{c} and @code{d} are printed on the
default staff. For the @code{e}, a context Staff called
@code{another} is specified; since that does not exist, a new
@@ -206,15 +207,13 @@
third quarter, @code{another} is removed.
-
@node Default contexts
@subsection Default contexts
Most music expressions don't need an explicit @code{\context}
-declaration: they inherit the
-notation context from their parent. Each note is a music expression, and
-as you can see in the following example, only the sequential music
-enclosing the three notes has an explicit context.
+declaration: they inherit the notation context from their parent. Each
+note is a music expression, and as you can see in the following example,
+only the sequential music enclosing the three notes has an explicit context.
@lilypond[verbatim,singleline]
\score { \notes \context Voice = goUp { c'4 d' e' } }
@@ -223,30 +222,32 @@
There are some quirks that you must keep in mind when dealing with
defaults:
-First, every top level music is interpreted by the Score context, in other
+First, every top level music is interpreted by the Score context; in other
words, you may think of @code{\score} working like
+
@example
- \score @{
- \context Score @var{music}
- @}
+\score @{
+ \context Score @var{music}
address@hidden
@end example
Second, contexts are created automatically to be able to interpret the
-music expressions. Consider the following example.
+music expressions. Consider the following example.
@lilypond[verbatim, singleline]
-\score { \context Score \notes { c'4 ( d' )e' } }
+\score { \context Score \notes { c'4 ( d' )e' } }
@end lilypond
address@hidden
The sequential music is interpreted by the Score context initially
(notice that the @code{\context} specification is redundant), but when a
-note is encountered, contexts are setup to accept that note. In this
-case, a Thread, Voice and Staff are created. The rest of the sequential
-music is also interpreted with the same Thread, Voice and Staff context,
-putting the notes on the same staff, in the same voice.
+note is encountered, contexts are setup to accept that note. In this
+case, a Thread, Voice, and Staff context are created. The rest of the
+sequential music is also interpreted with the same Thread, Voice, and
+Staff context, putting the notes on the same staff, in the same voice.
This is a convenient mechanism, but do not expect opening chords to work
-without @code{\context}. For every note, a separate staff is
+without @code{\context}. For every note, a separate staff is
instantiated.
@cindex explicit context
@@ -260,73 +261,78 @@
Of course, if the chord is preceded by a normal note in sequential
music, the chord will be interpreted by the Thread of the preceding
note:
+
@lilypond[verbatim,singleline]
-\score { \notes { c'4 <c'4 es'> } }
+\score { \notes { c'4 <c'4 es'> } }
@end lilypond
-
@node Context properties
@subsection Context properties
-Notation contexts have properties. These properties are from
-the @file{.ly} file using the following expression:
+Notation contexts have properties. These properties are from
+the @file{.ly} file using the following expression:
@cindex @code{\property}
+
@example
- \property @address@hidden = @var{value}
+\property @address@hidden = @var{value}
@end example
address@hidden
Sets the @var{propname} property of the context @var{contextname} to the
specified Scheme expression @var{value}. All @var{propname} and
@var{contextname} are strings, which are typically unquoted.
Properties that are set in one context are inherited by all of the
contained contexts. This means that a property valid for the
address@hidden context can be set in the @internalsref{Score} context (for
-example) and thus take effect in all @internalsref{Voice} contexts.
address@hidden context can be set in the @internalsref{Score} context
+(for example) and thus take effect in all @internalsref{Voice} contexts.
@cindex @code{Current}
If you don't wish to specify the name of the context in the
address@hidden
-itself, you can refer to the abstract context name,
address@hidden The @code{Current} context is the latest
-used context. This will typically mean the @internalsref{Thread}
address@hidden itself, you can refer to the abstract context
+name, @code{Current}. The @code{Current} context is the latest
+used context. This will typically mean the @internalsref{Thread}
context, but you can force another context with the
address@hidden Hence the expressions
address@hidden Hence the expressions
@example
- \property @address@hidden = @var{value}
+\property @address@hidden = @var{value}
@end example
address@hidden
and
@example
- \context @var{contextname}
- \property address@hidden = @var{value}
+\context @var{contextname}
+\property address@hidden = @var{value}
@end example
address@hidden
do the same thing.
-The main use for this is in macros - allowing the specification of a
+The main use for this is in macros -- allowing the specification of a
property-setting without restriction to a specific context.
Properties can be unset using the following expression:
+
@example
- \property @address@hidden \unset
+\property @address@hidden \unset
@end example
@cindex properties, unsetting
@cindex @code{\unset}
-This removes the definition of @var{propname} in @var{contextname}. If
address@hidden
+This removes the definition of @var{propname} in @var{contextname}. If
@var{propname} was not defined in @var{contextname} (but was inherited
from a higher context), then this has no effect.
-
@refbugs
The syntax of @code{\unset} is asymmetric: @code{\property \unset} is not
the inverse of @code{\property \set}.
+
@node Engravers and performers
@subsection Engravers and performers
@@ -336,75 +342,87 @@
special C++ classes.
-
@node Changing context definitions
@subsection Changing context definitions
-
@cindex context definition
@cindex translator definition
The most common way to define a context is by extending an existing
-context. You can change an existing context from the paper block, by
+context. You can change an existing context from the paper block by
first initializing a translator with an existing context identifier:
+
@example
\paper @{
\translator @{
@var{context-identifier}
- @} @}
+ @}
address@hidden
@end example
+
address@hidden
Then you can add and remove engravers using the following syntax:
+
@example
- \remove @var{engravername}
- \consists @var{engravername}
+\remove @var{engravername}
+\consists @var{engravername}
@end example
-
address@hidden
Here @var{engravername} is a string, the name of an engraver in the
system.
-
@lilypond[verbatim,singleline]
-\score { \notes {
- c'4 c'4 }
+\score {
+ \notes {
+ c'4 c'4
+ }
\paper {
- \translator { \StaffContext
- \remove Clef_engraver
- } } }
+ \translator {
+ \StaffContext
+ \remove Clef_engraver
+ }
+ }
+}
@end lilypond
@cindex engraver
-You can also set properties in a translator definition. The syntax is as
+You can also set properties in a translator definition. The syntax is as
follows:
+
@example
- @var{propname} = @var{value}
- @var{propname} \set @var{grob-propname} = @var{pvalue}
- @var{propname} \override @var{grob-propname} = @var{pvalue}
- @var{propname} \revert @var{grob-propname}
address@hidden = @var{value}
address@hidden \set @var{grob-propname} = @var{pvalue}
address@hidden \override @var{grob-propname} = @var{pvalue}
address@hidden \revert @var{grob-propname}
@end example
+
address@hidden
@var{propname} is a string, @var{grob-propname} a symbol, @var{value}
-and @code{pvalue} are Scheme expressions. These type of property
+and @code{pvalue} are Scheme expressions. These types of property
assignments happen before interpretation starts, so a @code{\property}
command will override any predefined settings.
-
- To simplify editing translators, all standard contexts have standard
+To simplify editing translators, all standard contexts have standard
identifiers called @address@hidden, e.g. @code{StaffContext},
address@hidden, see @file{ly/engraver-init.ly}.
address@hidden; see @file{ly/engraver-init.ly}.
+
@node Defining new contexts
@subsection Defining new contexts
If you want to build a context from scratch, you must also supply the
following extra information:
+
@itemize @bullet
- @item A name, specified by @code{\name @var{contextname}}.
address@hidden A name, specified by @code{\name @var{contextname}}.
- @item A cooperation module. This is specified by @code{\type
address@hidden A cooperation module. This is specified by @code{\type
@var{typename}}.
@end itemize
This is an example:
+
@example
\translator @code{
\type "Engraver_group_engraver"
@@ -416,52 +434,52 @@
}@
@end example
address@hidden
The argument of @code{\type} is the name for a special engraver that
handles cooperation between simple engravers such as
address@hidden and @code{Staff_symbol_engraver}. Alternatives
address@hidden and @code{Staff_symbol_engraver}. Alternatives
for this engraver are the following:
+
@table @code
@cindex @code{Engraver_group_engraver}
- @item @code{Engraver_group_engraver}
- The standard cooperation engraver.
address@hidden @code{Score_engraver}
-
- @item @code{Score_engraver}
- This is cooperation module that should be in the top level context,
-and only the top level context.
address@hidden @code{Engraver_group_engraver}
+The standard cooperation engraver.
address@hidden @code{Score_engraver}
address@hidden @code{Score_engraver}
+This is a cooperation module that should be in the top level context.
@end table
-Other modifiers are
+Other modifiers are
@itemize @bullet
- @item @code{\alias} @var{alternate-name}
- This specifies a different name. In the above example,
address@hidden @code{\alias} @var{alternate-name}:
+This specifies a different name. In the above example,
@code{\property Staff.X = Y} will also work on @code{SimpleStaff}s
- @item @code{\consistsend} @var{engravername}
- Analogous to @code{\consists}, but makes sure that
- @var{engravername} is always added to the end of the list of
- engravers.
address@hidden @code{\consistsend} @var{engravername}:
+Analogous to @code{\consists}, but makes sure that
address@hidden is always added to the end of the list of
+engravers.
- Some engraver types need to be at the end of the list; this
- insures they stay there even if a user adds or removes engravers.
+Some engraver types need to be at the end of the list; this
+insures they stay there even if a user adds or removes engravers.
End-users generally don't need this command.
- @item @code{\accepts} @var{contextname}
- Add @var{contextname} to the list of contexts this context can
- contain in the context hierarchy. The first listed context is the
- context to create by default.
address@hidden @code{\accepts} @var{contextname}:
+Add @var{contextname} to the list of contexts this context can
+contain in the context hierarchy. The first listed context is the
+context to create by default.
- @item @code{\denies}. The opposite of @code{\accepts}. Added for
address@hidden @code{\denies}:
+The opposite of @code{\accepts}. Added for
completeness, but is never used in practice.
-
-
- @item @code{\name} @var{contextname}
- This sets the type name of the context, e.g. @internalsref{Staff},
- @internalsref{Voice}. If the name is not specified, the translator won't
do
- anything.
+
address@hidden @code{\name} @var{contextname}:
+This sets the type name of the context, e.g. @internalsref{Staff},
address@hidden If the name is not specified, the translator won't do
+anything.
@end itemize
In the @code{\paper} block, it is also possible to define translator
@@ -469,7 +487,6 @@
be used as the very first item of a translator. In order to define
such an identifier outside of @code{\score}, you must do
address@hidden
@example
\paper @{
foo = \translator @{ @dots{} @}
@@ -484,9 +501,6 @@
@}
@end example
address@hidden quotation
-
-
@cindex paper types, engravers, and pre-defined translators
@@ -509,18 +523,18 @@
@c . {Identifiers}
@node Identifiers
@subsection Identifiers
address@hidden Identifiers
address@hidden Identifiers
@ignore
- What has this section got to do with identifiers?
- It seems more appropriate in the introduction to Chapter 4,
- "Internals".
+What has this section got to do with identifiers?
+It seems more appropriate in the introduction to Chapter 4,
+"Internals".
- /MB
+ /MB
@end ignore
-All of the information in a LilyPond input file, is internally
-represented as a Scheme value. In addition to normal Scheme data types
+All of the information in a LilyPond input file is internally
+represented as a Scheme value. In addition to normal Scheme data types
(such as pair, number, boolean, etc.), LilyPond has a number of
specialized data types,
@@ -537,25 +551,27 @@
@item Moment (rational number)
@end itemize
-LilyPond also includes some transient object types. Objects of these
+LilyPond also includes some transient object types. Objects of these
types are built during a LilyPond run, and do not `exist' per se within
-your input file. These objects are created as a result of your input
+your input file. These objects are created as a result of your input
file, so you can include commands in the input to manipulate them,
-during a lilypond run.
+during a LilyPond run.
@itemize @bullet
address@hidden Grob: short for Graphical object.
address@hidden Molecule: device-independent page output object,
-including dimensions. Produced by some Grob functions
address@hidden Translator: object that produces audio objects or Grobs. This is
-not yet user accessible.
address@hidden Font_metric: object representing a font.
address@hidden Grob: short for `Graphical object'.
+
address@hidden Molecule: Device-independent page output object,
+including dimensions. Produced by some Grob functions.
+
address@hidden Translator: An object that produces audio objects or Grobs.
This is
+not yet user-accessible.
+
address@hidden Font_metric: An object representing a font.
@end itemize
@node Music expressions
@subsection Music expressions
-
@cindex music expressions
Music in LilyPond is entered as a music expression. Notes, rests, lyric
@@ -577,72 +593,83 @@
@cindex Simultaneous music
@cindex @code{\simultaneous}
-The two basic compound music expressions are simultaneous and
+The two basic compound music expressions are simultaneous and
sequential music.
@example
- \sequential @address@hidden @var{musicexprlist} @address@hidden
- \simultaneous @address@hidden @var{musicexprlist} @address@hidden
+\sequential @address@hidden @var{musicexprlist} @address@hidden
+\simultaneous @address@hidden @var{musicexprlist} @address@hidden
@end example
+
For both, there is a shorthand:
+
@example
- @address@hidden @var{musicexprlist} @address@hidden
address@hidden@{} @var{musicexprlist} @address@hidden
@end example
+
address@hidden
for sequential and
+
@example
- @code{<} @var{musicexprlist} @code{>}
address@hidden<} @var{musicexprlist} @code{>}
@end example
+
address@hidden
for simultaneous music.
In principle, the way in which you nest sequential and simultaneous to
produce music is not relevant. In the following example, three chords
are expressed in two different ways:
@lilypond[fragment,verbatim,center]
- \notes \context Voice {
- <a c'> <b d' > <c' e'>
- < { a b c' } { c' d' e' } >
- }
+\notes \context Voice {
+ <a c'> <b d'> <c' e'>
+ < { a b c' } { c' d' e' } >
+}
@end lilypond
-
Other compound music expressions include
+
@example
- \repeat @var{expr}
- \transpose @var{pitch} @var{expr}
- \apply @var{func} @var{expr}
- \context @var{type} = @var{id} @var{expr}
- \times @var{fraction} @var{expr}
+\repeat @var{expr}
+\transpose @var{pitch} @var{expr}
+\apply @var{func} @var{expr}
+\context @var{type} = @var{id} @var{expr}
+\times @var{fraction} @var{expr}
@end example
@c . {Manipulating music expressions}
@node Manipulating music expressions
address@hidden Manipulating music expressions
address@hidden Manipulating music expressions
The @code{\apply} mechanism gives you access to the internal
-representation of music. You can write Scheme-functions that operate
-directly on it. The syntax is
+representation of music. You can write Scheme-functions that operate
+directly on it. The syntax is
+
@example
- \apply address@hidden @var{music}
+\apply address@hidden @var{music}
@end example
+
address@hidden
This means that @var{func} is applied to @var{music}. The function
@var{func} should return a music expression.
-This example replaces the text string of a script. It also shows a dump
+This example replaces the text string of a script. It also shows a dump
of the music it processes, which is useful if you want to know more
about how music is stored.
@lilypond[verbatim,singleline]
#(define (testfunc x)
- (if (equal? (ly-get-mus-property x 'text) "foo")
- (ly-set-mus-property! x 'text "bar"))
- ;; recurse
- (ly-set-mus-property! x 'elements
- (map testfunc (ly-get-mus-property x 'elements)))
- (display x)
- x
-)
-\score { \notes
+ (if (equal? (ly-get-mus-property x 'text) "foo")
+ (ly-set-mus-property! x 'text "bar"))
+ ;; recurse
+ (ly-set-mus-property! x 'elements
+ (map testfunc (ly-get-mus-property x 'elements)))
+ (display x)
+ x)
+
+\score {
+ \notes
\apply #testfunc { c'4_"foo" }
}
@end lilypond
@@ -650,8 +677,7 @@
For more information on what is possible, see the automatically
generated documentation.
-
-Directly accessing internal representations is dangerous: the
+Directly accessing internal representations is dangerous: The
implementation is subject to changes, so you should avoid this feature
if possible.
@@ -670,7 +696,8 @@
music = \notes { c'4 d'4( e'4 f'4 }
-\score { \context Voice {
+\score {
+ \context Voice {
\music
\apply #reverse-music \music
}
@@ -680,6 +707,7 @@
More examples are given in the distributed example files in
@code{input/test/}.
+
@c . {Span requests}
@menu
* Span requests::
@@ -690,29 +718,28 @@
@cindex Span requests
Notational constructs that start and end on different notes can be
-entered using span requests. The syntax is as follows:
-
+entered using span requests. The syntax is as follows:
@example
- \spanrequest @var{startstop} @var{type}
+\spanrequest @var{startstop} @var{type}
@end example
-
@cindex @code{\start}
@cindex @code{\stop}
-This defines a spanning request. The @var{startstop} parameter is either
address@hidden
+This defines a spanning request. The @var{startstop} parameter is either
-1 (@code{\start}) or 1 (@code{\stop}) and @var{type} is a string that
describes what should be started. Much of the syntactic sugar is a
-shorthand for @code{\spanrequest}, for example,
+shorthand for @code{\spanrequest}, for example
@lilypond[fragment,verbatim,center]
- c'4-\spanrequest \start "slur"
- c'4-\spanrequest \stop "slur"
+c'4-\spanrequest \start "slur"
+c'4-\spanrequest \stop "slur"
@end lilypond
Among the supported types are @code{crescendo}, @code{decrescendo},
address@hidden, @code{slur}. This is an internal command. Users are
address@hidden, @code{slur}. This is an internal command. Users are
encouraged to use the shorthands which are defined in the initialization
file @file{spanners.ly}.
@@ -723,8 +750,8 @@
@cindex Assignments
Identifiers allow objects to be assigned to names during the parse
-stage. To assign an identifier, you use @address@hidden@var{value}
-and to refer to an identifier, you precede its name with a backslash:
+stage. To assign an identifier, use @address@hidden@var{value}.
+To refer to an identifier, precede its name with a backslash:
address@hidden@var{name}'. @var{value} is any valid Scheme value or any of
the input-types listed above. Identifier assignments can appear at top
level in the LilyPond file, but also in @code{\paper} blocks.
@@ -745,15 +772,19 @@
When an identifier is referenced, the information it points to is
copied. For this reason, an identifier reference must always be the
first item in a block.
+
@example
-\paper @{
+\paper @{
foo = 1.0
\paperIdent % wrong and invalid
@}
address@hidden example
address@hidden
\paper @{
\paperIdent % correct
- foo = 1.0 @}
+ foo = 1.0
address@hidden
@end example
@@ -768,49 +799,51 @@
@cindex @code{\lyrics}
To simplify entering notes, lyrics, and chords, LilyPond has three
-special input modes in addition to the default mode: note, lyrics and
+special input modes in addition to the default mode: note, lyrics, and
chords mode. These input modes change the way that normal, unquoted
-words are interpreted: for example, the word @code{cis} may be
+words are interpreted: For example, the word @code{cis} may be
interpreted as a C-sharp, as a lyric syllable `cis' or as a C-sharp
major triad respectively.
A mode switch is entered as a compound music expression
+
@example
@code{\notes} @var{musicexpr}
@code{\chords} @var{musicexpr}
address@hidden @var{musicexpr}.
address@hidden @var{musicexpr}
@end example
address@hidden
In each of these cases, these expressions do not add anything to the
meaning of their arguments. They just instruct the parser in what mode
to parse their arguments.
Different input modes may be nested.
+
@c . {Ambiguities}
@node Ambiguities
@subsection Ambiguities
@cindex ambiguities
@cindex grammar
-
-The grammar contains a number of ambiguities. We hope to resolve them at
+The grammar contains a number of ambiguities. We hope to resolve them at
some time.
@itemize @bullet
- @item The assignment
address@hidden The assignment
@example
foo = bar
@end example
- is interpreted as the string identifier assignment. However,
+
address@hidden
+is interpreted as the string identifier assignment. However,
it can also be interpreted as making a string identifier @code{\foo}
containing @code{"bar"}, or a music identifier @code{\foo} containing
the syllable `bar'. The former interpretation is chosen.
- @item If you do a nested repeat like
-
- @quotation
address@hidden If you do a nested repeat like
@example
\repeat @dots{}
@@ -818,19 +851,18 @@
\alternative
@end example
- @end quotation
-
- then it is ambiguous to which @code{\repeat} the
- @code{\alternative} belongs. This is the classic if-then-else
- dilemma. It may be solved by using braces.
-
address@hidden
+then it is ambiguous to which @code{\repeat} the
address@hidden belongs. This is the classic if-then-else
+dilemma. It may be solved by using braces.
@end itemize
+
@c . {Lexical details}
@node Lexical details
@section Lexical details
-Even more boring details, now on lexical side of the input parser.
+Even more boring details, now on the lexical side of the input parser.
@menu
* Direct Scheme::
@@ -841,46 +873,45 @@
@node Direct Scheme
@subsection Direct Scheme
-
@cindex Scheme
@cindex GUILE
@cindex Scheme, in-line code
-
-
-
address@hidden GUILE
address@hidden Scheme
@cindex accessing Scheme
@cindex evaluating Scheme
@cindex LISP
-LilyPond internally uses GUILE, a Scheme-interpreter. Scheme is a
-language from the LISP family. You can learn more about Scheme at
address@hidden://www.scheme.org}. It is used to represent data throughout
-the whole program. The hash-sign (@code{#}) accesses GUILE directly: the
+LilyPond internally uses GUILE, a Scheme-interpreter. Scheme is a
+language from the LISP family. You can learn more about Scheme at
address@hidden://www.scheme.org}. It is used to represent data throughout
+the whole program. The hash-sign (@code{#}) accesses GUILE directly: The
code following the hash-sign is evaluated as Scheme. The boolean value
@var{true} is @code{#t} in Scheme, so for LilyPond @var{true} looks like
@code{##t}.
LilyPond contains a Scheme interpreter (the GUILE library) for
-internal use. In some places, Scheme expressions also form valid syntax:
-wherever it is allowed,
+internal use. In some places, Scheme expressions also form valid syntax:
+Wherever it is allowed,
+
@example
- address@hidden
address@hidden
@end example
+
address@hidden
evaluates the specified Scheme code. Example:
+
@example
- \property Staff.TestObject \override #'foobar = #(+ 1 2)
+\property Staff.TestObject \override #'foobar = #(+ 1 2)
@end example
address@hidden expects two Scheme expressions, so there are two Scheme
-expressions. The first one is a symbol (@code{foobar}), the second one
+
address@hidden expects two Scheme expressions.
+The first one is a symbol (@code{foobar}), the second one
an integer (namely, 3).
-In-line scheme may be used at the top level. In this case the result is
+In-line Scheme may be used at the top level. In this case the result is
discarded.
Scheme is a full-blown programming language, and a full discussion is
-outside the scope of this document. Interested readers are referred to
+outside the scope of this document. Interested readers are referred to
the website @uref{http://www.schemers.org/} for more information on
Scheme.
@@ -904,7 +935,7 @@
A real constant can be followed by one of the dimension keywords:
@code{\mm} @code{\pt}, @code{\in}, or @code{\cm}, for millimeters,
points, inches and centimeters, respectively. This converts the number
-a number that is the internal representation of that dimension.
+that is the internal representation of that dimension.
@node Strings
@@ -918,3 +949,87 @@
that contains no spaces can be written without the quotes. Strings can
be concatenated with the @code{+} operator.
+
address@hidden . {Output details}
address@hidden Output details
address@hidden Output details
+
+LilyPond's default output format is @TeX{}. Using the option @option{-f}
+(or @option{--format}) other output formats can be selected also, but
+currently none of them reliably work.
+
+At the beginning of the output file, various global parameters are defined.
+It also contains a large @code{\special} call to define PostScript routines
+to draw items not representable with @TeX{}, mainly slurs and ties. A DVI
+driver must be able to understand such embedded PostScript, or the output
+will be rendered incompletely.
+
+Then the file @file{lilyponddefs.tex} is loaded to define the macros used
+in the code which follows. @file{lilyponddefs.tex} includes various other
+files, partially depending on the global parameters.
+
+Now the music is output system by system (a `system' consists of all
+staves belonging together). From @TeX{}'s point of view, a system is an
address@hidden which contains a lowered @code{\vbox} so that it is centered
+vertically on the baseline of the text. Between systems,
address@hidden is inserted vertically to have stretchable space.
+The horizontal dimension of the @code{\hbox} is given by the
address@hidden parameter from LilyPond's @code{\paper} block (using the
+natural line width if its value address@hidden address@hidden).
+
+After the last system LilyPond emits a stronger variant of
address@hidden only if the macro @code{\lilypondpaperlastpagefill}
+is not defined (flushing the systems to the top of the page). You can
+avoid that manually by saying
+
address@hidden
address@hidden@}
address@hidden example
+
address@hidden
+or by setting the variable @code{lastpagefill} in LilyPond's @code{\paper}
+block.
+
+It is possible to fine-tune the vertical offset further by defining the
+macro @code{\lilypondscoreshift}. Example:
+
address@hidden
address@hidden@}
address@hidden example
+
address@hidden
address@hidden is the distance from one text line to the next.
+
+The code produced by LilyPond can be used by both @TeX{} and address@hidden
+
+Here an example how to embed a small LilyPond file @code{foo.ly} into
+running address@hidden text without using the @code{lilypond-book} script
+(@pxref{Integrating text and music with lilypond-book}).
+
address@hidden
address@hidden@}
+
address@hidden@}
+\lineskip 5pt
address@hidden@}
+
address@hidden@}
+This is running text which includes an example music file
address@hidden@}
+right here.
address@hidden@}
address@hidden example
+
+The file @file{foo.tex} has been simply produced with
+
address@hidden
+lilypond foo.ly
address@hidden example
+
+It is important to set the @code{indent} parameter to zero in the
address@hidden block of @file{foo.ly}.
+
+The call to @code{\lineskip} assures that there is enough vertical space
+between the LilyPond box and the surrounding text lines.
+
address@hidden EOF
--- ./buildscripts/mf-to-table.py.old Mon Aug 19 00:17:57 2002
+++ ./buildscripts/mf-to-table.py Fri Sep 13 18:30:00 2002
@@ -120,7 +120,8 @@
def write_tex_defs (file, global_info, charmetrics):
nm = global_info['FontFamily']
for m in charmetrics:
- file.write (r'''\def\%s%s{\char%d}%s''' % (nm, m['tex'],
m['code'],'\n'))
+ file.write (r'''\def\%s%s{\char%d}%%%s''' % (nm, m['tex'],
m['code'],'\n'))
+ file.write ('\\endinput\n')
def write_ps_encoding (file, global_info, charmetrics):
encs = ['.notdef'] * 256
--- ./lily/system.cc.old Sun Aug 18 00:36:48 2002
+++ ./lily/system.cc Sat Sep 14 16:10:51 2002
@@ -442,7 +442,10 @@
/*
line preamble.
*/
+ Interval j (extent (this, X_AXIS));
+ Real length = j[RIGHT];
output_scheme (scm_list_n (ly_symbol2scm ("start-system"),
+ gh_double2scm (length),
gh_double2scm (height),
SCM_UNDEFINED));
--- ./scm/tex.scm.old Wed Sep 11 08:20:57 2002
+++ ./scm/tex.scm Sun Sep 15 00:24:36 2002
@@ -51,7 +51,7 @@
(define (unknown)
- "%\n\\unknown%\n")
+ "%\n\\unknown\n")
(define (select-font name-mag-pair)
(let*
@@ -142,7 +142,7 @@
(begin
; uncomment for some stats about lily
memory
; (display (gc-stats))
- (string-append "\n\\EndLilyPondOutput\n"
+ (string-append "%\n\\EndLilyPondOutput\n"
; Put GC stats here.
)))
@@ -168,7 +168,7 @@
((equal? (ly-unit) "pt") (/ 72.0 72.27))
(else (error "unknown unit" (ly-unit)))
))
- " mul }"
+ " mul }%\n"
"\\special{\\string! "
;; URG: ly-gulp-file: now we can't use scm output without Lily
@@ -179,8 +179,9 @@
(ly-gulp-file "music-drawing-routines.ps"))
; (if (defined? 'ps-testing) "/testing true def%\n" "")
"}"
- "\\input lilyponddefs \\outputscale=\\lilypondpaperoutputscale
\\lilypondpaperunit"
- "\\turnOnPostScript"))
+ "\\input lilyponddefs\n"
+ "\\outputscale=\\lilypondpaperoutputscale \\lilypondpaperunit\n"
+ "\\turnOnPostScript\n"))
;; Note: this string must match the string in ly2dvi.py!!!
(define (header creator generate)
@@ -211,7 +212,7 @@
(tex-val (output-tex-string val)))
(if (equal? (sans-surrounding-whitespace tex-val) "")
(string-append "\\let\\" tex-key "\\undefined\n")
- (string-append "\\def\\" tex-key "{" tex-val "}\n"))))
+ (string-append "\\def\\" tex-key "{" tex-val "}%\n"))))
(define (number->dim x)
(string-append
@@ -229,14 +230,21 @@
(define (bezier-sandwich l thick)
(embedded-ps (list 'bezier-sandwich `(quote ,l) thick)))
-(define (start-system ht)
- (string-append "\\vbox to " (number->dim ht) "{\\hbox{"
- "%\n"))
+(define (start-system wd ht)
+ (string-append "\\leavevmode\n"
+ "\\scoreshift = " (number->dim (* ht 0.5)) "\n"
+ "\\ifundefined{lilypondscoreshift}%\n"
+ "\\else\n"
+ " \\advance\\scoreshift by -\\lilypondscoreshift\n"
+ "\\fi\n"
+ "\\hbox to " (number->dim wd) "{%\n"
+ "\\lower\\scoreshift\n"
+ "\\vbox to " (number->dim ht) "{\\hbox{%\n"))
(define (stop-system)
- "}\\vss}\\interscoreline\n")
+ "}\\vss}\\hss}\\interscoreline\n")
(define (stop-last-system)
- "}\\vss}")
+ "}\\vss}\\hss}")
(define (filledbox breapth width depth height)
(if (and #f (defined? 'ps-testing))
--- ./scm/sketch.scm.old Tue Jul 23 15:43:34 2002
+++ ./scm/sketch.scm Sat Sep 14 00:51:31 2002
@@ -247,9 +247,9 @@
sketch-beziers (list x y (primitive-eval l) thick)))
; TODO: use HEIGHT argument
-(define (start-system height)
+(define (start-system width height)
"G()\n"
- )
+)
;; r((520.305,0,0,98.0075,51.8863,10.089))
;; width, 0, 0, height, x, y
--- ./scm/ps.scm.old Thu Aug 15 07:11:43 2002
+++ ./scm/ps.scm Sat Sep 14 09:36:03 2002
@@ -264,14 +264,11 @@
; TODO: use HEIGHT argument
- (define (start-system height)
- (string-append
- "\n"
- (ly-number->string height)
- " start-system {
-set-ps-scale-to-lily-scale
-
-"))
+(define (start-system width height)
+ (string-append "\n" (ly-number->string height)
+ " start-system\n"
+ "{\n"
+ "set-ps-scale-to-lily-scale"))
(define (stem breapth width depth height)
(string-append (numbers->string (list breapth width depth height))
--- ./scm/pdftex.scm.old Sat Aug 17 00:11:00 2002
+++ ./scm/pdftex.scm Sun Sep 15 00:26:59 2002
@@ -20,7 +20,7 @@
(define this-module (current-module))
(define (unknown)
- "%\n\\unknown%\n")
+ "%\n\\unknown\n")
(define (select-font name-mag-pair)
@@ -113,7 +113,7 @@
(begin
; uncomment for some stats about lily
memory
; (display (gc-stats))
- (string-append "\n\\EndLilyPondOutput"
+ (string-append "%\n\\EndLilyPondOutput\n"
; Put GC stats here.
)))
@@ -163,9 +163,10 @@
((equal? (ly-unit) "pt") (/ 72.0 72.27))
(else (error "unknown unit" (ly-unit)))
))
- "}\n"
- "\\input lilyponddefs \\outputscale=\\lilypondpaperoutputscale
\\lilypondpaperunit"
- "\\turnOnPostScript"
+ "}%\n"
+ "\\input lilyponddefs\n"
+ "\\outputscale=\\lilypondpaperoutputscale \\lilypondpaperunit\n"
+ "\\turnOnPostScript\n"
"\\pdfcompresslevel=0"))
;; Note: this string must match the string in ly2dvi.py!!!
@@ -196,7 +197,7 @@
(tex-val (output-tex-string val)))
(if (equal? (sans-surrounding-whitespace tex-val) "")
(string-append "\\let\\" tex-key "\\undefined\n")
- (string-append "\\def\\" tex-key "{" tex-val "}\n"))))
+ (string-append "\\def\\" tex-key "{" tex-val "}%\n"))))
(define (number->dim x)
(string-append
@@ -214,13 +215,21 @@
(define (bezier-sandwich l thick)
(embedded-pdf (list 'bezier-sandwich `(quote ,l) thick)))
-(define (start-system ht)
- (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n"))
+(define (start-system wd ht)
+ (string-append "\\leavevmode\n"
+ "\\scoreshift = " (number->dim (* ht 0.5)) "\n"
+ "\\ifundefined{lilypondscoreshift}%\n"
+ "\\else\n"
+ " \\advance\\scoreshift by -\\lilypondscoreshift\n"
+ "\\fi\n"
+ "\\hbox to " (number->dim wd) "{%\n"
+ "\\lower\\scoreshift\n"
+ "\\vbox to " (number->dim ht) "{\\hbox{%\n"))
(define (stop-system)
- "}\\vss}\\interscoreline\n")
+ "}\\vss}\\hss}\\interscoreline\n")
(define (stop-last-system)
- "}\\vss}")
+ "}\\vss}\\hss}")
(define (filledbox breapth width depth height)
(string-append
"\\kern" (number->dim (- breapth))
--- ./scm/pdf.scm.old Sat Aug 17 00:11:00 2002
+++ ./scm/pdf.scm Sat Sep 14 00:46:15 2002
@@ -221,7 +221,7 @@
(* (- y1 y2) (- y1 y2)))) 2))))
-(define (start-system height) "")
+(define (start-system width height) "")
(define (stem breadth width depth height)
(filledbox breadth width depth height))
--- ./scm/ascii-script.scm.old Tue Jul 23 15:43:34 2002
+++ ./scm/ascii-script.scm Sat Sep 14 09:39:23 2002
@@ -204,8 +204,8 @@
"") ; issue no command
(func "select-font" (car name-mag-pair))))
-(define (start-system height)
- (func "start-system" height))
+(define (start-system width height)
+ (func "start-system" width height))
(define (stop-system)
(func "stop-system"))
--- ./scripts/ly2dvi.py.old Fri Sep 6 02:28:12 2002
+++ ./scripts/ly2dvi.py Sat Sep 14 16:48:13 2002
@@ -689,6 +689,7 @@
s = global_latex_preamble (extra) + '\\begin{document}\n'
+ s = s + '\\parindent 0pt\n'
s = s + '\\thispagestyle{firstpage}\n'
first = 1
--- ./tex/lily-ps-defs.tex.old Sat Mar 23 02:43:29 2002
+++ ./tex/lily-ps-defs.tex Sat Sep 14 14:28:51 2002
@@ -1,27 +1,38 @@
+% lily-ps-defs.tex
%
-% WARNING: don't leave blank lines in the PS-code; they are
-% transformed into \par
-%
+\edef\lilypsdefsELC{\the\endlinechar}%
+\endlinechar -1\relax
-%
-% header info (macros/defs, etc) should go into a \special{! ... },
+% Header info (macros/defs, etc) should go into a \special{! ... };
% note the ! sign. See dvips.info for details.
%
-% escape the colon with \string to avoid problems with french babel
-%
-\def\PSsetTeXdimen#1{\expandafter\special{! /#1 (\csname #1\endcsname)
set_tex_dimen}}
+% Escape the colon with \string to avoid problems with French while using
+% the Babel package.
+
+\def\PSsetTeXdimen#1{
+ \expandafter\special{
+ ! /#1 (\csname #1\endcsname) set_tex_dimen
+ }
+}
+
\def\lilySpace{ }
-\def\turnOnPostScript{%
- % This sets CTM so that you get to the currentpoint
- % by executing a 0 0 moveto
- \def\embeddedps##1{%
- \special{ps\string: @beginspecial @setspecial
- \lilypondpaperoutputscale\lilySpace\scaletounit
- \lilypondpaperoutputscale\lilySpace\scaletounit
- % FUCKING REDHAT XDVI -- ARG!
- skeel ##1 @endspecial}%
- }
- \PSsetTeXdimen{lilypondpaperblotdiameter}
+
+\def\turnOnPostScript{
+ % This sets CTM so that you get to the currentpoint
+ % by executing a 0 0 moveto
+ \def\embeddedps##1{
+ \special{
+ ps\string: @beginspecial @setspecial %
+ \lilypondpaperoutputscale\lilySpace\scaletounit %
+ \lilypondpaperoutputscale\lilySpace\scaletounit %
+ % FUCKING REDHAT XDVI -- ARG!
+ skeel ##1 @endspecial
+ }
+ }
+ \PSsetTeXdimen{lilypondpaperblotdiameter}
}
+
\def\turnOnExperimentalFeatures{}
+\endlinechar \lilypsdefsELC
+\endinput
--- ./tex/lilypond-plaintex.tex.old Sun Nov 12 23:29:58 2000
+++ ./tex/lilypond-plaintex.tex Sat Sep 14 09:52:18 2002
@@ -1,9 +1,25 @@
+% lilypond-plaintex.tex
+%
+\edef\lilypondplaintexELC{\the\endlinechar}%
+\endlinechar -1\relax
+
\message{LilyPond Plain TeX settings}
- \def\texsuffix{PlainTeX}
+
+\def\texsuffix{PlainTeX}
\def\lilyfooterPlainTeX{
- \footline={\ifnum\pageno=1\smalltextfont\lilypondcopyright\hfil
\lilypondtagline
- \else\hfil\the\pageno\hfil\fi}%
+ \footline = {
+ \ifnum\pageno = 1\relax
+ \smalltextfont\lilypondcopyright\hfil \lilypondtagline
+ \else
+ \hfil \the\pageno \hfil
+ \fi
+ }
}
+
\advance\hoffset by -.6in
+
\def\nolilyfooterPlainTeX{\nopagenumbers}
+
+\endlinechar \lilypondplaintexELC
+\endinput
--- ./tex/lilyponddefs.tex.old Tue Aug 6 00:51:16 2002
+++ ./tex/lilyponddefs.tex Sun Sep 15 00:16:29 2002
@@ -1,43 +1,61 @@
-%%
-%% include file for LilyPond
-%%
-%% this file defines various macros to accomodate lilypond output
-%%
-%% let's not make par before endinput
+% lilyponddefs.tex
+%
+% Include file for LilyPond.
+%
+% This file defines various macros to accomodate lilypond output.
+%
+\edef\lilyponddefsELC{\the\endlinechar}%
+\endlinechar -1\relax
% TeXbook ex 7.7
-\def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax}
+\def\ifundefined#1{
+ \expandafter\ifx\csname#1\endcsname\relax
+}
+% If we must make titles, do so, before we're skipped.
+
+\ifx\mustmakelilypondtitle\undefined
+\else
+ \makelilypondtitle
+\fi
+
+\ifx\mustmakelilypondpiecetitle\undefined
+\else
+ \makelilypondpiecetitle
+\fi
-% If we must make titles, do so, before we're Skipped.
-\ifx\mustmakelilypondtitle\undefined\else\makelilypondtitle\fi
-\ifx\mustmakelilypondpiecetitle\undefined\else\makelilypondpiecetitle\fi
-%
% skip if included already
+
\def\SkipLilydefs{\endinput}
\ifundefined{EndLilyPondOutput}
- \def\EndLilyPondOutput{\csname bye\endcsname}
- \def\SkipLilydefs{}
+ \def\EndLilyPondOutput{\csname bye\endcsname}
+ \def\SkipLilydefs{}
\fi
\SkipLilydefs
-% need to do some stuff to turn pagenumbering off
+% need to do some stuff to turn page numbering off
+
\ifundefined{documentclass}
- \input lilypond-plaintex
+ \input lilypond-plaintex
\else
- \input lilypond-latex
+ \input lilypond-latex
\fi
% The feta characters
\input feta20.tex
-\font\fetasixteen=feta16
+\font\fetasixteen = feta16
\def\fetafont{\fetasixteen}
\def\fetachar#1{\hbox{\fetasixteen#1}}
+\def\botalign#1{
+ \vbox to 0pt{\vss #1}
+}
+\def\leftalign#1{
+ \hbox to 0pt{#1\hss}
+}
-\def\botalign#1{\vbox to 0pt{\vss #1}}
-\def\leftalign#1{\hbox to 0pt{#1\hss}}
+\newdimen\scoreshift
% Attempt to keep lilypiecetitle together with the piece:
@@ -45,22 +63,28 @@
% TODO: figure this out.
%
-\def\myfilbreak{} %\par\vfil\penalty200\vfilneg}
+\def\myfilbreak{}%\par\vfil\penalty200\vfilneg}
\ifundefined{lilypondpaperinterscorelinefill}
- \def\lilypondpaperinterscorelinefill{0}
+ \def\lilypondpaperinterscorelinefill{0}
\else
- \def\lilypondpaperinterscorelinefill{1}
+ \def\lilypondpaperinterscorelinefill{1}
\fi
-\def\interscoreline{\vskip \lilypondpaperinterscoreline \lilypondpaperunit
plus \lilypondpaperinterscorelinefill fill}
-
-\def\placebox#1#2#3{%
- \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}}%
+\def\interscoreline{
+ \vskip \lilypondpaperinterscoreline \lilypondpaperunit
+ plus \lilypondpaperinterscorelinefill fill
+}
+
+\def\placebox#1#2#3{
+ \botalign{
+ \hbox{\raise #1\leftalign{\kern #2{}#3}}
+ }
+}
% Are we using PDFTeX? If so, use pdf definitions.
-% MiKTeX checks \pdfoutput the wrong way, makes our
+% MiKTeX checks \pdfoutput the wrong way; this makes our
% check more complicated.
\ifx\pdfoutput\undefined
\input lily-ps-defs
@@ -68,30 +92,32 @@
\ifx\pdfoutput\relax
\input lily-ps-defs
\else
- \pdfoutput=1
+ \pdfoutput = 1
\input lily-pdf-defs
\fi
\fi
-\def\EndLilyPondOutput{%
-\ifundefined{lilypondpaperlastpagefill}%
- \vskip 0pt plus \lilypondpaperinterscorelinefill00 fill
-\fi
-\csname bye\endcsname}
+\def\EndLilyPondOutput{
+ \ifundefined{lilypondpaperlastpagefill}
+ \vskip 0pt plus \lilypondpaperinterscorelinefill00 fill
+ \fi
+ \csname bye\endcsname
+}
-% need to do some stuff to turn pagenumbering off
-% they seriously mess up your fragments.
+% Need to do some stuff to turn page numbering off;
+% they seriously mess up your fragments.
\ifx\csname nolilyfooter\endcsname\relax
- \message{[footer defined]}%
- \csname lilyfooter\texsuffix\endcsname%
+ \message{[footer defined]}
+ \csname lilyfooter\texsuffix\endcsname
\else
- \message{[footer empty]}
- \csname%
- nolilyfooter\texsuffix\endcsname
+ \message{[footer empty]}
+ \csname nolilyfooter\texsuffix\endcsname
\fi
\ifx\outputscale\undefined
- \csname global\endcsname\csname newdimen\endcsname\outputscale
+ \csname global\endcsname\csname newdimen\endcsname\outputscale
\fi
+
+\endlinechar \lilyponddefsELC
\endinput
--- ./tex/lily-pdf-defs.tex.old Sat Aug 17 00:11:01 2002
+++ ./tex/lily-pdf-defs.tex Sat Sep 14 09:51:25 2002
@@ -1,17 +1,27 @@
-% Defines an embeddedpdf command so that we can do the right thing.
+% lily-pdf-defs.tex
+%
+% Define an \embeddedpdf command so that we can do the right thing.
+%
+\edef\lilypdfdefsELC{\the\endlinechar}%
+\endlinechar -1\relax
\def\lilySpace{ }
-\def\turnOnPostScript{%
- % This sets CTM so that you get to the currentpoint
- % by executing a 0 0 moveto
- \def\embeddedpdf##1{%
- \pdfliteral{q \lilypondpaperoutputscale\lilySpace 0 0 %
- \lilypondpaperoutputscale\lilySpace 0 0 cm %
- \lilyoutputscalefactor\lilySpace 0 0 %
- \lilyoutputscalefactor\lilySpace 0 0 cm %
- ##1 Q}%
- }
+
+\def\turnOnPostScript{
+ % This sets CTM so that you get to the currentpoint
+ % by executing a 0 0 moveto
+ \def\embeddedpdf##1{
+ \pdfliteral{
+ q \lilypondpaperoutputscale\lilySpace 0 0 %
+ \lilypondpaperoutputscale\lilySpace 0 0 cm %
+ \lilyoutputscalefactor\lilySpace 0 0 %
+ \lilyoutputscalefactor\lilySpace 0 0 cm %
+ ##1 Q
+ }
+ }
}
\def\turnOnExperimentalFeatures{}
+\endlinechar \lilypdfdefsELC
+\endinput
--- ./tex/lilypond-latex.tex.old Sun Nov 12 23:29:58 2000
+++ ./tex/lilypond-latex.tex Sat Sep 14 09:50:56 2002
@@ -1,26 +1,46 @@
+% lilypond-latex.tex
+%
+\edef\lilypondlatexELC{\the\endlinechar}%
+\endlinechar -1\relax
+
\message{LaTeX definitions}
+
\def\texsuffix{LaTeX}
+
\def\lilyfooterLaTeX{
-\let\nopagenumbers\relax
- %% FIXME
- address@hidden
- address@hidden
- address@hidden
- address@hidden
- address@hidden
- \ifnum\thepage=1{\hfil \lilypondtagline}%
- \else{%
- foo\hfil\the\pageno\hfil}%
- \fi}}
- address@hidden
- address@hidden
- address@hidden
- address@hidden
- address@hidden
- \ifnum\thepage=1{\hfil \lilypondtagline}%
- \else{foo\hfil\the\pageno\hfil}%
- \fi}}%
-\nopagenumbers
+ \let\nopagenumbers\relax
+
+ %% FIXME
+ address@hidden
+ address@hidden
+ address@hidden
+ address@hidden
+ address@hidden
+ \ifnum\thepage = 1\relax
+ {\hfil \lilypondtagline}
+ \else
+ {foo\hfil \the\pageno \hfil}
+ \fi
+ }
+ }
+
+ address@hidden
+ address@hidden
+ address@hidden
+ address@hidden
+ address@hidden
+ \ifnum\thepage = 1\relax
+ {\hfil \lilypondtagline}
+ \else
+ {foo\hfil \the\pageno \hfil}
+ \fi
+ }
+ }
+
+ \nopagenumbers
}
\def\nolilyfooterLaTeX{}
+
+\endlinechar \lilypondlatexELC
+\endinput
--- ./tex/titledefs.tex.old Wed Aug 28 07:09:28 2002
+++ ./tex/titledefs.tex Sat Sep 14 14:52:13 2002
@@ -1,100 +1,195 @@
-%%
-%% LilyPond titling for LaTeX
-%%
-%% Note
-%%
-%% Defining a value, but leaving it empty:
-%% \def\lilypondfoo{}
-%% makes LaTeX break on the \\ in:
-%% \ifx\lilypondfoo\undefined\else{\lilypondfoo\\}\fi
-%%
+% titledefs.tex
+%
+% LilyPond titling for LaTeX
+%
+% Note:
+%
+% Defining a value, but leaving it empty:
+% \def\lilypondfoo{}
+% makes LaTeX break on the \\ in:
+% \ifx\lilypondfoo\undefined\else{\lilypondfoo\\}\fi
+%
+\edef\titledefsELC{\the\endlinechar}%
+\endlinechar -1\relax
+
% The feta characters for use in titles
\input feta20.tex
-%
+
\font\fetasixteen=feta16
\def\fetafont{\fetasixteen}
\def\fetachar#1{\hbox{\fetasixteen#1}}
-%
-\def\makelilypondtitle
-{
+
+\def\makelilypondtitle{
\begin{center}
-
\ifx\lilyponddedication\undefined\else{\normalfont\lilyponddedication\\}\fi
- \bfseries
- \ifx\lilypondtitle\undefined\else{\huge\lilypondtitle\\}\fi
- \ifx\lilypondsubtitle\undefined\else{\Large\lilypondsubtitle\\}\fi
-
\ifx\lilypondsubsubtitle\undefined\else{\large\lilypondsubsubtitle\\}\fi
+ \ifx\lilyponddedication\undefined
+ \else
+ {\normalfont\lilyponddedication\\}
+ \fi
+
+ \bfseries
+
+ \ifx\lilypondtitle\undefined
+ \else
+ {\huge\lilypondtitle\\}
+ \fi
+
+ \ifx\lilypondsubtitle\undefined
+ \else
+ {\Large\lilypondsubtitle\\}
+ \fi
+
+ \ifx\lilypondsubsubtitle\undefined
+ \else
+ {\large\lilypondsubsubtitle\\}
+ \fi
\end{center}
+
\bigskip
- % urg
- \edef\saveparskip{\parskip}\parskip-5mm
+
\begin{minipage}[t]{0.45\textwidth}
- \ifx\lilypondpoet\undefined\else{\lilypondpoet\\}\fi
-
\ifx\lilypondtexttranslator\undefined\else{\lilypondtexttranslator\\}\fi
- \ifx\lilypondmeter\undefined\else{\lilypondmeter\\}\fi
- \end{minipage}\hspace*{\fill}
+ \ifx\lilypondpoet\undefined
+ \else
+ {\lilypondpoet\\}
+ \fi
+
+ \ifx\lilypondtexttranslator\undefined
+ \else
+ {\lilypondtexttranslator\\}
+ \fi
+
+ \ifx\lilypondmeter\undefined
+ \else
+ {\lilypondmeter\\}
+ \fi
+ \end{minipage}
+
+ \hspace*{\fill}
+
\begin{minipage}[t]{0.45\textwidth}
- \begin{flushright}
-
\ifx\lilypondcomposer\undefined\else{\large\normalfont\scshape\lilypondcomposer\\}\fi
- \ifx\lilypondopus\undefined\else{\lilypondopus\\}\fi
- \ifx\lilypondarranger\undefined\else{\lilypondarranger\\}\fi
- \end{flushright}%
- \end{minipage}\par
- \parskip\saveparskip
-
\ifx\lilypondinstrument\undefined\else{\center{\large\lilypondinstrument}\par}\fi
-
\ifx\lilypondpiece\undefined\else{\flushleft{\large\normalfont\scshape\lilypondpiece}\par}\fi
-% \leavevmode
- \global\let\lilypondopus\relax%
- \global\let\lilypondpiece\relax%
- \global\let\mustmakelilypondtitle\undefined%
+ \begin{flushright}
+ \ifx\lilypondcomposer\undefined
+ \else
+ {\large\normalfont\scshape\lilypondcomposer\\}
+ \fi
+
+ \ifx\lilypondopus\undefined
+ \else
+ {\lilypondopus\\}
+ \fi
+
+ \ifx\lilypondarranger\undefined
+ \else
+ {\lilypondarranger\\}
+ \fi
+ \end{flushright}
+ \end{minipage}
+
+ \par
+
+ \ifx\lilypondinstrument\undefined
+ \else
+ {\center{\large\lilypondinstrument}
+ \par}
+ \fi
+
+ \ifx\lilypondpiece\undefined
+ \else
+ {\flushleft{\large\normalfont\scshape\lilypondpiece}
+ \par}
+ \fi
+
+% \leavevmode
+
+ \global\let\lilypondopus\relax
+ \global\let\lilypondpiece\relax
+ \global\let\mustmakelilypondtitle\undefined
}
-%
-\def\makelilypondpiecetitle
-{
+
+\def\makelilypondpiecetitle{
\bigskip\myfilbreak
- \ifx\lilypondopus\undefined\else{\flushright{\lilypondopus}\par}\fi
-
\ifx\lilypondpiece\undefined\else{\flushleft{\large\normalfont\scshape\lilypondpiece}\par}\fi
- \nopagebreak%
- \global\let\lilypondopus\relax%
- \global\let\lilypondpiece\relax%
- \global\let\mustmakelilypondpiecetitle\undefined%
+
+ \ifx\lilypondopus\undefined
+ \else
+ {\flushright{\lilypondopus}
+ \par}
+ \fi
+
+ \ifx\lilypondpiece\undefined
+ \else
+ {\flushleft{\large\normalfont\scshape\lilypondpiece}
+ \par}
+ \fi
+
+ \nopagebreak
+
+ \global\let\lilypondopus\relax
+ \global\let\lilypondpiece\relax
+ \global\let\mustmakelilypondpiecetitle\undefined
}
+
% header -- head ?
-% these names can't be changed: they're uses in mutopia headers
-\def\theheader
-{
- \ifx\lilypondhead\undefined\relax\else%
- \lilypondhead\fi
-}
-\def\thefooter
-{
- \ifx\lilypondfooter\undefined\relax\else%
- \lilypondfooter\fi
-}
-\def\makelilypondtagline
-{
- \ifx\undefined\lilypondtagline\relax\else\lilypondtagline\fi
-}
-\def\thecopyright
-{
- \ifx\lilypondcopyright\undefined\thefooter\else%
- \lilypondcopyright\fi
+% these names can't be changed: they're used in mutopia headers
+
+\def\theheader{
+ \ifx\lilypondhead\undefined
+ \else
+ \lilypondhead
+ \fi
}
-%
+
+\def\thefooter{
+ \ifx\lilypondfooter\undefined
+ \else
+ \lilypondfooter
+ \fi
+}
+
+\def\makelilypondtagline{
+ \ifx\undefined\lilypondtagline
+ \else
+ \lilypondtagline
+ \fi
+}
+
+\def\thecopyright{
+ \ifx\lilypondcopyright\undefined
+ \thefooter
+ \else
+ \lilypondcopyright
+ \fi
+}
+
% Moved header and footer definitions here from the ly2dvi script.
% Separate page styles for first, last and ordinary (plain) pages.
+
\makeatletter
+
address@hidden
- address@hidden
- address@hidden@oddfoot}%
- address@hidden to\textwidth{\textbf{\thepage}\hfill{\small\theheader}}}
- address@hidden to
- \textwidth{{\small\theheader}\hfill\textbf{\thepage}}}}
+ address@hidden
+ \parbox{\textwidth}{\mbox{}\thefooter}}
+ address@hidden
+ address@hidden
+ address@hidden
+ \hbox to \textwidth{\textbf{\thepage}\hfill{\small\theheader}}}
+ address@hidden
+ \hbox to \textwidth{{\small\theheader}\hfill\textbf{\thepage}}}
+}
+
address@hidden
- address@hidden
- address@hidden@oddfoot}}
+ address@hidden
+ \parbox{\textwidth}{\mbox{}\thecopyright}}
+ address@hidden
+ address@hidden
+}
+
address@hidden
- address@hidden
- address@hidden@oddfoot}}
+ address@hidden
+ \parbox{\textwidth}{\mbox{}\makelilypondtagline}}
+ address@hidden
+ address@hidden
+}
+
\makeatother
-\endinput
+\endlinechar \titledefsELC
+\endinput
- improved TeX output,
Werner LEMBERG <=