1 %%% lilyponddefs.tex -- TeX macros for LilyPond output.
3 %%% source file of the GNU LilyPond music typesetter
5 %%% (c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
6 %%% Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 %%% Mats Bengtsson <mats.bengtsson@s3.kth.se>
9 %% Avoid \par while reading this file.
10 \edef\lilyponddefsELC{\the\endlinechar}%
13 %% This runs with plain TeX, LaTeX, pdftex, and texinfo.
15 %% To avoid interferences, lilyponddefs.tex must be loaded within a group.
16 %% It is loaded only once, so the definitions must be global.
18 %% The overall structure of a file created by LilyPond is as follows:
20 %% <lilypond parameter definitions>
21 %% \ifx\lilypondstart \undefined
22 %% \input lilyponddefs
25 %% <font setup and note output>
31 %% Handy macros from the LaTeX manual.
32 \long\gdef\lilypondfirst#1#2{#1}
33 \long\gdef\lilypondsecond#1#2{#2}
34 \gdef\lilypondifundefined#1{
35 \expandafter\ifx\csname#1\endcsname\relax
36 \expandafter\lilypondfirst
38 \expandafter\lilypondsecond
45 %% \@nodocument is defined as \relax after `\begin{document}'
46 \lilypondifundefined{@nodocument
}
48 %% either plain TeX or texinfo or not at the beginning of LaTeX input
52 %% provide a proper LaTeX preamble (for A4 paper format)
55 \def\lilyponddocument{}
56 \documentclass[a4paper]{article
}
61 \lilypondifundefined{lilypondclassic
}
63 %% Nullify [La]TeX page layout settings, page layout by LilyPond.
65 \headheight0pt\headsep0pt
67 \evensidemargin\oddsidemargin
70 %% Center staves horizontally on page
71 \ifdim\lilypondpaperlinewidth\lilypondpaperunit >
0pt
72 \hsize\lilypondpaperlinewidth\lilypondpaperunit
73 \lytempdim \paperwidth
74 \advance\lytempdim -
\the\hsize
75 \lytempdim 0.5\lytempdim
76 \advance\lytempdim -
1in
77 \oddsidemargin \lytempdim
78 \evensidemargin \lytempdim
82 %% TEXINFO workaround: \begin is defined as \outer, use \csname.
83 \csname begin
\endcsname{document}}}
87 \lilypondifundefined{lilypondbook
}
88 {\lilypondifundefined{lilypondpaperlastpagefill
}
89 {\vskip 0pt plus
\lilypondpaperinterscorelinefill00 fill
}
93 \lilypondifundefined{lilyponddocument
}
95 {\def\x{\endgroup\csname end
\endcsname{document}}}
98 %% Inversed \loop ... \repeat macro
99 \def\lilypondloop#1\lilypondrepeat{
100 \def\lilypondbody{#1}
104 \def\lilyponditerate{
107 \let\lilypondnext \relax
109 \let\lilypondnext \lilyponditerate
114 %% Allow overriding of pagebreak
115 \lilypondifundefined{lilypondpagebreak
}
117 \lilypondifundefined{@nodocument
}
118 {\gdef\lilypondpagebreak{\eject}}
119 {\gdef\lilypondpagebreak{\newpage}}
123 %% Include \special only once.
124 \gdef\lilypondspecial{
125 \special{header=music-drawing-routines.ps
}
126 \gdef\lilypondspecial{}
129 %% The feta characters.
132 \global\font\fetasixteen = feta16
133 \gdef\fetafont{\fetasixteen}
134 \gdef\fetachar#1{\hbox{\fetasixteen#1}}
136 \gdef\topalign#1{\vbox to
0pt
{\hbox{#1}\vss}}
137 \gdef\leftalign#1{\hbox to
0pt
{#1\hss}}
140 \topalign{\raise#2\outputscale\leftalign{\kern#1\outputscale#3}}}
142 \gdef\lybox#1#2#3#4#5{
143 \lytempdim\baselineskip
144 \advance\lytempdim-
#4\outputscale
146 \vbox to
#4\outputscale{
147 \leftalign{\kern#1\outputscale\lower#2\outputscale\topalign{#5}}
150 \gdef\lyvrule#1#2#3#4{
152 \vrule width
#2\outputscale depth
#3\outputscale height
#4\outputscale}
154 %% FIXME: 'interscoreline' and 'lilypondPAPERinterscoreline
155 \lilypondifundefined{lilypondpaperinterscorelinefill
}
156 {\gdef\lilypondpaperinterscorelinefill{0}}
157 {\gdef\lilypondpaperinterscorelinefill{1}}
159 %% Allow overriding of interscoreline, e.g. for lilypond.py's --preview
160 \lilypondifundefined{interscoreline
}
162 \lilypondifundefined{lilypondclassic
}
163 {\gdef\interscoreline{}}
164 {\gdef\interscoreline{
165 \vskip\lilypondpaperinterscoreline\lilypondpaperunit
166 plus
\lilypondpaperinterscorelinefill fill
}}
170 %% Include postscript definitions unless using PDFTeX,
171 %% in that case use pdf definitions.
172 %% MiKTeX workaround: use \csname.
173 \lilypondifundefined{lilypondpostscript
}
174 {\lilypondifundefined{pdfoutput
}
175 {\input lily-ps-defs
}
177 \input lily-pdf-defs
}}
180 %% Restore newline functionality (disabled to avoid \par).
181 \endlinechar \lilyponddefsELC
184 %% end lilyponddefs.tex