Next: Integrating Texinfo and music, Previous: An example of a musicological document, Up: LilyPond-book
LaTeX is the de-facto standard for publishing layouts in the exact sciences. It is built on top of the TeX typesetting engine, providing the best typography available anywhere.
See The Not So Short Introduction to LaTeX for an overview on how to use LaTeX.
Music is entered using
\begin[options,go,here]{lilypond} YOUR LILYPOND CODE \end{lilypond}
or
\lilypondfile[options,go,here]{filename}
or
\lilypond{ YOUR LILYPOND CODE }
Running lilypond-book yields a file that can be further processed with LaTeX.
We show some examples here. The lilypond environment
\begin[quote,fragment,staffsize=26]{lilypond} c' d' e' f' g'2 g'2 \end{lilypond}
produces
The short version
\lilypond[quote,fragment,staffsize=11]{<c' e' g'>}
produces
Currently, you cannot include {
or }
within
\lilypond{}
, so this command is only useful with the
fragment
option.
The default linewidth of the music will be adjusted by examining the
commands in the document preamble, the part of the document before
\begin{document}
. The lilypond-book command sends
these to LaTeX to find out how wide the text is. The line width for
the music fragments is then adjusted to the text width. Note that this
heuristic algorithm can fail easily; in such cases it is necessary to
use the linewidth
music fragment option.
Each snippet calls \preLilyPondExample
before and
\postLilyPondExample
after the music if those macros have been
defined by the user.
For printing the LaTeX document you need a DVI to PostScript translator like dvips. For producing PostScript with scalable fonts, add the following options to the dvips command line:
-Ppdf -u+lilypond.map -u+ec-mftrace.map
PDF can then be produced with a PostScript to PDF translator like
ps2pdf
(which is part of GhostScript).
[THE FOLLOWING IS OUT OF DATE. ]
LilyPond does not use the LaTeX font handling scheme for lyrics and
text markups; it uses the EC font family and has limited support for
selecting an input encoding with the \encoding
keyword if the
output is directly processed (these limitations primarily affect
LilyPond's native PostScript output). With lilypond-book, the
encoding issues are completely handled by the document which includes
LilyPond snippets; lilypond outputs all text strings without
modification. The drawback is that LilyPond always applies the EC font
metrics to those strings for computing the locations within the music
snippets; this often causes unpleasant horizontal (and vertical) shifts.
With other words, support for encodings other than latin-1 is
possible but usually yields badly positioned text. Future versions of
LilyPond will fix this.
Since latin-1 is the default encoding for LilyPond markup and lyrics
it is not necessary to explicitly add \encoding "latin1"
to
LilyPond snippets. You might also consider the use of \encoding
"TeX"
instead which basically makes LilyPond skip TeX commands
(starting with a backslash) and braces in text strings – it is not
recommended, though, since LilyPond gives only a rough approximation to
the real string length.
As a corrolary of the last paragraphs the following two lines should be present in the LaTeX document preamble
[END OUT OF DATE]
\usepackage[latin1]{inputenc} \usepackage[T1]{fontenc}
and real latin-1 characters should be used in LilyPond snippets; for
example, use ß
, not \ss
.
This page is for LilyPond-2.5.11 (development-branch).