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 %% FIXME: empirical computer science: page is ca 5mm too low.
62 \advance\topmargin-5mm
63 \headheight0pt\headsep0pt
65 \evensidemargin\oddsidemargin
67 %% TEXINFO workaround: \begin is defined as \outer, use \csname.
68 \csname begin\endcsname{document}}}
72 \lilypondifundefined{lilypondbook}
73 {\lilypondifundefined{lilypondpaperlastpagefill}
74 {\vskip 0pt plus\lilypondpaperinterscorelinefill00 fill}
78 \lilypondifundefined{lilyponddocument}
80 {\def\x{\endgroup\csname end\endcsname{document}}}
83 %% Inversed \loop ... \repeat macro
84 \def\lilypondloop#1\lilypondrepeat{
92 \let\lilypondnext \relax
94 \let\lilypondnext \lilyponditerate
99 %% Include \special only once.
100 \gdef\lilypondspecial{
101 \special{header=music-drawing-routines.ps}
102 \gdef\lilypondspecial{}
105 %% The feta characters.
108 \global\font\fetasixteen = feta16
109 \gdef\fetafont{\fetasixteen}
110 \gdef\fetachar#1{\hbox{\fetasixteen#1}}
112 \gdef\topalign#1{\vbox to 0pt{\hbox{#1}\vss}}
113 \gdef\leftalign#1{\hbox to 0pt{#1\hss}}
116 \topalign{\raise#2\outputscale\leftalign{\kern#1\outputscale#3}}}
118 \gdef\XXXlybox#1#2#3#4#5{
119 \vbox to #4\outputscale{
120 \hbox to #3\outputscale{
121 \leftalign{\kern#1\outputscale\lower#2\outputscale\topalign{#5}}}
124 %% FIXME: no dimensions, should fix at toplevel
125 \gdef\lybox#1#2#3#4#5{
126 \leftalign{\kern#1\outputscale\lower#2\outputscale\topalign{#5}}}
128 \gdef\lyvrule#1#2#3#4{
130 \vrule width #2\outputscale depth #3\outputscale height #4\outputscale}
132 \lilypondifundefined{lilypondpaperinterscorelinefill}
133 {\gdef\lilypondpaperinterscorelinefill{0}}
134 {\gdef\lilypondpaperinterscorelinefill{1}}
136 %% Allow overriding of interscoreline, e.g. for lilypond.py's --preview
137 \lilypondifundefined{interscoreline}
138 {\gdef\interscoreline{}}{}
140 %% Include postscript definitions unless using PDFTeX,
141 %% in that case use pdf definitions.
142 %% MiKTeX workaround: use \csname.
143 \lilypondifundefined{lilypondpostscript}
144 {\lilypondifundefined{pdfoutput}
145 {\input lily-ps-defs }
147 \input lily-pdf-defs }}
150 %% Restore newline functionality (disabled to avoid \par).
151 \endlinechar \lilyponddefsELC
154 %% end lilyponddefs.tex