3 % Include file for LilyPond.
5 % This file defines various macros to acommodate lilypond output.
7 % It should run with plain TeX, LaTeX, pdftex, and texinfo.
9 % To avoid interferences, lilyponddefs.tex should be loaded within a group.
10 % To load it only once, most of the definitions must be global.
12 % The overall structure of a file created by LilyPond is as follows:
14 % <lilypond parameter definitions>
15 % \ifx\lilypondstart \undefined
19 % <font setup and note output>
22 % No footers and headers are provided for the stand-alone run (i.e., for
23 % directly saying `latex <LilyPond output>'.
26 % Avoid \par while reading this file.
27 \edef\lilyponddefsELC{\the\endlinechar}%
30 % the next three macros are taken from LaTeX
31 \long\gdef\lilypondfirst#1#2{#1}
33 \long\gdef\lilypondsecond#1#2{#2}
35 \gdef\lilypondifundefined#1{
36 \expandafter\ifx\csname#1\endcsname\relax
37 \expandafter\lilypondfirst
39 \expandafter\lilypondsecond
46 % \@nodocument is defined as \relax after `\begin{document}'
47 \lilypondifundefined{@nodocument}
49 % either plain TeX or texinfo or not at the beginning of LaTeX input
53 % provide a proper LaTeX preamble (for A4 paper format)
56 \def\lilyponddocument{}
57 \documentclass[a4paper]{article}
60 % \begin is defined as \outer in texinfo, thus we use \csname
61 \csname begin\endcsname{document}
62 % center staves horizontally on page
63 \ifdim\lilypondpaperlinewidth\lilypondpaperunit > 0pt
64 \hsize\lilypondpaperlinewidth\lilypondpaperunit
65 % we abuse \scoreshift temporarily
66 \scoreshift \paperwidth
67 \advance\scoreshift -\the\hsize
68 \scoreshift 0.5\scoreshift
69 \advance\scoreshift -1in
70 \oddsidemargin \scoreshift
71 \evensidemargin \scoreshift
79 \lilypondifundefined{mustmakelilypondtitle}
83 \lilypondifundefined{mustmakelilypondpiecetitle}
85 {\makelilypondpiecetitle}
89 \lilypondifundefined{lilypondbook}
90 {\lilypondifundefined{lilypondpaperlastpagefill}
91 {\vskip 0pt plus \lilypondpaperinterscorelinefill00 fill}
97 \lilypondifundefined{lilyponddocument}
104 \csname end\endcsname{document}
111 % this is an inversed \loop ... \repeat macro
112 \def\lilypondloop#1\lilypondrepeat{
113 \def\lilypondbody{#1}
117 \def\lilyponditerate{
120 \let\lilypondnext \relax
122 \let\lilypondnext \lilyponditerate
127 % the following macro is executed only once
128 \gdef\lilypondspecial{
129 \special{header=music-drawing-routines.ps}
130 \gdef\lilypondspecial{}
133 % the feta characters
136 \global\font\fetasixteen = feta16
137 \gdef\fetafont{\fetasixteen}
138 \gdef\fetachar#1{\hbox{\fetasixteen#1}}
141 \vbox to 0pt{\vss #1}
149 \hbox{\raise #1\outputscale
150 \leftalign{\kern #2\outputscale #3}}
155 \hbox to #1\outputscale {
156 \lower\scoreshift \vbox to #2\outputscale {
164 \gdef\lyvrule#1#2#3#4{
166 \vrule width #2\outputscale depth #3\outputscale height #4\outputscale
169 % Attempt to keep lilypiecetitle together with the piece:
171 % TODO: figure this out.
172 \gdef\myfilbreak{}%\par\vfil\penalty200\vfilneg}
174 \lilypondifundefined{lilypondpaperinterscorelinefill}
175 {\gdef\lilypondpaperinterscorelinefill{0}}
176 {\gdef\lilypondpaperinterscorelinefill{1}}
178 %% Allow overriding of interscoreline, eg for lilypond --preview
179 \lilypondifundefined{interscoreline}
180 {\gdef\interscoreline{
181 \vskip \lilypondpaperinterscoreline \lilypondpaperunit
182 plus \lilypondpaperinterscorelinefill fill
185 % Are we using PDFTeX? If so, use pdf definitions.
186 % MiKTeX checks \pdfoutput the wrong way, thus we use \csname.
187 \lilypondifundefined{lilypondpostscript}
189 \lilypondifundefined{pdfoutput}
190 {\input lily-ps-defs }
193 \input lily-pdf-defs %
198 \newdimen\outputscale
201 % Restore newline functionality (disabled to avoid \par).
202 \endlinechar \lilyponddefsELC