[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
TeX output of lilypond
From: |
Werner LEMBERG |
Subject: |
TeX output of lilypond |
Date: |
Tue, 10 Sep 2002 21:53:38 +0200 (CEST) |
Handling the TeX output of lilypond in LaTeX is not easy. For
example, to center a music piece you have to do the following
currently (assuming that the line length of the music is 120mm):
\hfill
\hbox to 120mm {\vbox{%
\input eg-strophe.tex
}}
\hfill
\hbox{}
I doubt that many lilypond users have the patience/knowledge to find
this solution -- \begin{center} ... \end{center} doesn't work.
Is there any reason why staves aren't wrapped with a proper
\hbox/\vbox construction to give the staves a natural width and
height?
I suggest the following code around staves:
% From latex.ltx
\nexbox\voidbox
\def\leavevmode{\unhbox\voidbox}
\leavevmode
\hbox to <staff-length> {%
\lower <0.4 * staff-height1>% 0.4 is an ad-hoc value
<original lilypond staff1>%
\hss
}%
\interscoreline
\leavevmode
\hbox to <staff-length> {%
\lower <0.4 * staff-height2>%
<original lilypond staff2>%
\hss
}%
\interscoreline
...
Then I can say for foo.ly:
\begin{center}
\input foo.tex
\end{center}
Even more, if all constructions which produce a space and/or
paragraphs are removed in the various lilypond .tex initialization
files (I consider this a bug anyway), you can say
These three notes
\input three.tex
are part of the melody.
and three.tex is indeed embedded into the text, no longer producing a
paragraph of its own. The 0.4 constant to lower the staves should be
made configurable, of course.
The perhaps cleanest solution to avoid a zillion of trailing percent
signs is to say
\endlinechar -1
at the beginning of a file; now newlines no longer produce spaces or
paragraphs. At the end this must be reset with
\endlinechar `\^^M
If you like, I can prepare a patch.
Werner
PS: BTW, lilypond doesn't write a final newline at the end of the file.
- TeX output of lilypond,
Werner LEMBERG <=