]> git.donarmstrong.com Git - lilypond.git/blob - tex/titledefs.tex
* Documentation/user/lilypond-book.itely
[lilypond.git] / tex / titledefs.tex
1 % titledefs.tex
2 %
3 % LilyPond titling for LaTeX
4 %
5 % Note:
6 %
7 %    Defining a value, but leaving it empty:
8 %        \def\lilypondfoo{}
9 %    makes LaTeX break on the \\ in:
10 %        \ifx\lilypondfoo\undefined\else{\lilypondfoo\\}\fi
11 %
12 \edef\titledefsELC{\the\endlinechar}%
13 \endlinechar -1\relax
14
15 % The feta characters for use in titles
16 \input feta20.tex
17
18 \font\fetasixteen=feta16
19 \def\fetafont{\fetasixteen}
20 \def\fetachar#1{\hbox{\fetasixteen#1}}
21
22 \def\makelilypondtitle{
23   \begin{center}
24     \ifx\lilyponddedication\undefined
25     \else
26       {\normalfont\lilyponddedication\\}
27     \fi
28
29     \bfseries
30
31     \ifx\lilypondtitle\undefined
32     \else
33       {\huge\lilypondtitle\\}
34     \fi
35
36     \ifx\lilypondsubtitle\undefined
37     \else
38       {\Large\lilypondsubtitle\\}
39     \fi
40
41     \ifx\lilypondsubsubtitle\undefined
42     \else
43       {\large\lilypondsubsubtitle\\}
44     \fi
45   \end{center}
46
47   \bigskip
48
49   \begin{minipage}[t]{0.45\textwidth}
50     \ifx\lilypondpoet\undefined
51     \else
52       {\lilypondpoet\\}
53     \fi
54
55     \ifx\lilypondtexttranslator\undefined
56     \else
57       {\lilypondtexttranslator\\}
58     \fi
59
60     \ifx\lilypondmeter\undefined
61     \else
62       {\lilypondmeter\\}
63     \fi
64   \end{minipage}
65
66   \hspace*{\fill}
67
68   \begin{minipage}[t]{0.45\textwidth}
69     \begin{flushright}
70       \ifx\lilypondcomposer\undefined
71       \else
72         {\large\normalfont\scshape\lilypondcomposer\\}
73       \fi
74
75       \ifx\lilypondopus\undefined
76       \else
77         {\lilypondopus\\}
78       \fi
79
80       \ifx\lilypondarranger\undefined
81       \else
82         {\lilypondarranger\\}
83       \fi
84     \end{flushright}
85   \end{minipage}
86
87   \par
88
89   \ifx\lilypondinstrument\undefined
90   \else
91     {\center{\large\lilypondinstrument}
92      \par}
93   \fi
94
95   \ifx\lilypondpiece\undefined
96   \else
97     {\flushleft{\large\normalfont\scshape\lilypondpiece}
98      \par}
99   \fi
100
101 % \leavevmode
102
103   \global\let\lilypondopus\relax
104   \global\let\lilypondpiece\relax
105   \global\let\mustmakelilypondtitle\undefined
106 }
107
108 \def\makelilypondpiecetitle{
109   \bigskip\myfilbreak
110
111   \ifx\lilypondopus\undefined
112   \else
113     {\flushright{\lilypondopus}
114      \par}
115   \fi
116
117   \ifx\lilypondpiece\undefined
118   \else
119     {\flushleft{\large\normalfont\scshape\lilypondpiece}
120      \par}
121   \fi
122
123   \nopagebreak
124
125   \global\let\lilypondopus\relax
126   \global\let\lilypondpiece\relax
127   \global\let\mustmakelilypondpiecetitle\undefined
128 }
129
130 % header -- head ?
131 % these names can't be changed: they're used in mutopia headers
132
133 \def\theheader{
134   \ifx\lilypondhead\undefined
135   \else
136     \lilypondhead
137   \fi
138 }
139
140 \def\thefooter{
141   \ifx\lilypondfooter\undefined
142   \else
143     \lilypondfooter
144   \fi
145 }
146
147 \def\makelilypondtagline{
148   \ifx\undefined\lilypondtagline
149   \else
150     \lilypondtagline
151   \fi
152 }
153
154 \def\thecopyright{
155   \ifx\lilypondcopyright\undefined
156     \thefooter
157   \else
158     \lilypondcopyright
159   \fi
160 }
161
162 % Moved header and footer definitions here from the lilypond script.
163 % Separate page styles for first, last and ordinary (plain) pages.
164
165 \makeatletter
166
167 \renewcommand{\ps@plain}{
168   \renewcommand{\@oddfoot}{
169     \parbox{\textwidth}{\mbox{}\thefooter}}
170   \renewcommand{\@evenfoot}{
171     \@oddfoot}
172   \renewcommand{\@evenhead}{
173     \hbox to \textwidth{\textbf{\thepage}\hfill{\small\theheader}}}
174   \renewcommand{\@oddhead}{
175     \hbox to \textwidth{{\small\theheader}\hfill\textbf{\thepage}}}
176 }
177
178 \newcommand{\ps@firstpage}{
179   \renewcommand{\@oddfoot}{
180     \parbox{\textwidth}{\mbox{}\thecopyright}}
181   \renewcommand{\@evenfoot}{
182     \@oddfoot}
183 }
184
185 \newcommand{\ps@lastpage}{
186   \renewcommand{\@oddfoot}{
187     \parbox{\textwidth}{\mbox{}\makelilypondtagline}}
188   \renewcommand{\@evenfoot}{
189     \@oddfoot}
190 }
191
192 \makeatother
193
194 \endlinechar \titledefsELC
195 \endinput