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>
30 %% Handy macros from the LaTeX manual.
31 \long\gdef\lilypondfirst#1#2{#1}
32 \long\gdef\lilypondsecond#1#2{#2}
33 \gdef\lilypondifundefined#1{
34 \expandafter\ifx\csname#1\endcsname\relax
35 \expandafter\lilypondfirst
37 \expandafter\lilypondsecond
44 %% \@nodocument is defined as \relax after `\begin{document}'
45 \lilypondifundefined{@nodocument}
47 %% either plain TeX or texinfo or not at the beginning of LaTeX input
51 %% provide a proper LaTeX preamble (for A4 paper format)
54 \def\lilyponddocument{}
55 \documentclass[a4paper]{article}
58 %% Nullify [La]TeX page layout settings, page layout by LilyPond.
61 \headheight0pt\headsep0pt
63 \evensidemargin\oddsidemargin
65 %% TEXINFO workaround: \begin is defined as \outer, use \csname.
66 \csname begin\endcsname{document}}}
70 \lilypondifundefined{lilypondbook}
71 {\lilypondifundefined{lilypondpaperlastpagefill}
72 {\vskip 0pt plus\lilypondpaperinterscorelinefill00 fill}
76 \lilypondifundefined{lilyponddocument}
78 {\def\x{\endgroup\csname end\endcsname{document}}}
81 %% Inversed \loop ... \repeat macro
82 \def\lilypondloop#1\lilypondrepeat{
90 \let\lilypondnext \relax
92 \let\lilypondnext \lilyponditerate
97 %% Include \special only once.
98 \gdef\lilypondspecial{
99 \special{header=music-drawing-routines.ps}
100 \gdef\lilypondspecial{}
103 %% The feta characters.
106 \global\font\fetasixteen = feta16
107 \gdef\fetafont{\fetasixteen}
108 \gdef\fetachar#1{\hbox{\fetasixteen#1}}
110 \gdef\topalign#1{\vbox to 0pt{\hbox{#1}\vss}}
111 \gdef\leftalign#1{\hbox to 0pt{#1\hss}}
114 \topalign{\raise#2\outputscale\leftalign{\kern#1\outputscale#3}}}
117 \gdef\lybox#1#2#3#4#5{
118 \lytempdim\baselineskip
119 \advance\lytempdim-#4\outputscale
121 \vbox to#4\outputscale{
122 \leftalign{\kern#1\outputscale\lower#2\outputscale\topalign{#5}}
125 \gdef\lyvrule#1#2#3#4{
127 \vrule width #2\outputscale depth #3\outputscale height #4\outputscale}
129 \lilypondifundefined{lilypondpaperinterscorelinefill}
130 {\gdef\lilypondpaperinterscorelinefill{0}}
131 {\gdef\lilypondpaperinterscorelinefill{1}}
133 %% Allow overriding of interscoreline, e.g. for lilypond.py's --preview
134 \lilypondifundefined{interscoreline}
135 {\gdef\interscoreline{}}{}
137 %% Include postscript definitions unless using PDFTeX,
138 %% in that case use pdf definitions.
139 %% MiKTeX workaround: use \csname.
140 \lilypondifundefined{lilypondpostscript}
141 {\lilypondifundefined{pdfoutput}
142 {\input lily-ps-defs }
144 \input lily-pdf-defs }}
147 %% Restore newline functionality (disabled to avoid \par).
148 \endlinechar \lilyponddefsELC
151 %% end lilyponddefs.tex