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}
59 % \begin is defined as \outer in texinfo, thus we use \csname
60 \csname begin\endcsname{document}
61 % center staves horizontally on page
62 \ifdim\lilypondpaperlinewidth\lilypondpaperunit > 0pt
63 \hsize\lilypondpaperlinewidth\lilypondpaperunit
64 % we abuse \scoreshift temporarily
65 \scoreshift \paperwidth
66 \advance\scoreshift -\the\hsize
67 \scoreshift 0.5\scoreshift
68 \advance\scoreshift -1in
69 \oddsidemargin \scoreshift
70 \evensidemargin \scoreshift
78 \lilypondifundefined{mustmakelilypondtitle}
82 \lilypondifundefined{mustmakelilypondpiecetitle}
84 {\makelilypondpiecetitle}
88 \lilypondifundefined{lilypondbook}
89 {\lilypondifundefined{lilypondpaperlastpagefill}
90 {\vskip 0pt plus \lilypondpaperinterscorelinefill00 fill}
96 \lilypondifundefined{lilyponddocument}
103 \csname end\endcsname{document}
110 % this is an inversed \loop ... \repeat macro
111 \def\lilypondloop#1\lilypondrepeat{
112 \def\lilypondbody{#1}
116 \def\lilyponditerate{
119 \let\lilypondnext \relax
121 \let\lilypondnext \lilyponditerate
126 \newread\lilypondinput
128 % the following macro is executed only once
129 \gdef\lilypondspecial{
130 \special{header=music-drawing-routines.ps}
131 \gdef\lilypondspecial{}
134 % the feta characters
137 \global\font\fetasixteen = feta16
138 \gdef\fetafont{\fetasixteen}
139 \gdef\fetachar#1{\hbox{\fetasixteen#1}}
142 \vbox to 0pt{\vss #1}
150 \hbox{\raise #1\outputscale
151 \leftalign{\kern #2\outputscale #3}}
156 \hbox to #1\outputscale {
157 \lower\scoreshift \vbox to #2\outputscale {
165 \gdef\lyvrule#1#2#3#4{
167 \vrule width #2\outputscale depth #3\outputscale height #4\outputscale
170 % Attempt to keep lilypiecetitle together with the piece:
172 % TODO: figure this out.
173 \gdef\myfilbreak{}%\par\vfil\penalty200\vfilneg}
175 \lilypondifundefined{lilypondpaperinterscorelinefill}
176 {\gdef\lilypondpaperinterscorelinefill{0}}
177 {\gdef\lilypondpaperinterscorelinefill{1}}
179 \gdef\interscoreline{
180 \vskip \lilypondpaperinterscoreline \lilypondpaperunit
181 plus \lilypondpaperinterscorelinefill fill
184 % Are we using PDFTeX? If so, use pdf definitions.
185 % MiKTeX checks \pdfoutput the wrong way, thus we use \csname.
186 \lilypondifundefined{lilypondpostscript}
188 \lilypondifundefined{pdfoutput}
189 {\input lily-ps-defs }
197 \newdimen\outputscale
200 % Restore newline functionality (disabled to avoid \par).
201 \endlinechar \lilyponddefsELC