]> git.donarmstrong.com Git - lilypond.git/blobdiff - tex/titledefs.tex
release: 1.4.3
[lilypond.git] / tex / titledefs.tex
index fd18c5b60615e103ea3fea90b6720402dc8d835e..fd680ff7e47c0eb8420d93633ab35549f0467d8c 100644 (file)
@@ -1,77 +1,93 @@
-%
-% ideally, we should create a LaTeX/TeX class
-% for setting music in different sizes.
-%
-% Version 0.1
-%
-\input lilyponddefs
-\def\EndLilyPondOutput{\endinput}
-%
-\def\thetitle{}
-\def\thesubtitle{}
-\def\thecomposer{}
-\def\thearranger{}
-\def\theinstrument{}
-\def\theopus{}
-\def\thepiece{}
-\def\themetre{}
-\def\thepoet{}
-%
-% duh.  LaTeX has a \title too.
-\renewcommand*{\title}[1]{\def\thetitle{#1}}
-\newcommand*{\subtitle}[1]{\def\thesubtitle{#1}}
-\newcommand*{\composer}[1]{\def\thecomposer{#1}}
-\newcommand*{\arranger}[1]{\def\thearranger{#1}}
-\newcommand*{\instrument}[1]{\def\theinstrument{#1}}
-\newcommand*{\opus}[1]{\def\theopus{#1}}
-\newcommand*{\piece}[1]{\def\thepiece{#1}}
-\newcommand*{\metre}[1]{\def\themetre{#1}}
-\newcommand*{\poet}[1]{\def\thepoet{#1}}
-%
-\newcommand*{\mudelatitle}[1]{\def\thetitle{#1}}
-\newcommand*{\mudelasubtitle}[1]{\def\thesubtitle{#1}}
-\newcommand*{\mudelacomposer}[1]{\def\thecomposer{#1}}
-\newcommand*{\mudelaarranger}[1]{\def\thearranger{#1}}
-\newcommand*{\mudelainstrument}[1]{\def\theinstrument{#1}}
-\newcommand*{\mudelaopus}[1]{\def\theopus{#1}}
-\newcommand*{\mudelapiece}[1]{\def\thepiece{#1}}
-\newcommand*{\mudelametre}[1]{\def\themetre{#1}}
-\newcommand*{\mudelameter}[1]{\def\themetre{#1}}
-\newcommand*{\mudelapoet}[1]{\def\thepoet{#1}}
-%
-%
-\def\mudelanull{}%
-%
-\def\makelilytitle{%
+%%
+%% LilyPond titling for LaTeX
+%%
+%% Note
+%%
+%%    Defining a value, but leaving it empty:
+%%        \def\lilypondfoo{}
+%%    makes LaTeX break on the \\ in:
+%%        \ifx\lilypondfoo\undefined\else{\lilypondfoo\\}\fi
+%%
+\def\makelilypondtitle
+{
   \begin{center}
+        \ifx\lilyponddedication\undefined\else{\normalfont\lilyponddedication\\}\fi
         \bfseries
-        \ifx\mudelanull\thetitle\else{\huge\thetitle}\\ \fi
-        \ifx\mudelanull\thesubtitle\else{\Large\thesubtitle}\\ \fi
+        \ifx\lilypondtitle\undefined\else{\huge\lilypondtitle\\}\fi
+        \ifx\lilypondsubtitle\undefined\else{\Large\lilypondsubtitle\\}\fi
+        \ifx\lilypondsubsubtitle\undefined\else{\large\lilypondsubsubtitle\\}\fi
   \end{center}
   \bigskip
   % urg
   \edef\saveparskip{\parskip}\parskip-5mm
   \begin{minipage}[t]{0.45\textwidth}
-        \ifx\mudelanull\thepoet\else{\thepoet}\\ \fi
-        \ifx\mudelanull\themetre\else{\themetre}\\ \fi
+        \ifx\lilypondpoet\undefined\else{\lilypondpoet\\}\fi
+        \ifx\lilypondtexttranslator\undefined\else{\lilypondtexttranslator\\}\fi
+        \ifx\lilypondmeter\undefined\else{\lilypondmeter\\}\fi
   \end{minipage}\hspace*{\fill}
   \begin{minipage}[t]{0.45\textwidth}
       \begin{flushright}
-          \ifx\mudelanull\thecomposer\else{\large\normalfont\scshape\thecomposer}\\ \fi
-          \ifx\mudelanull\theopus\else{\theopus}\\ \fi
-          \ifx\mudelanull\thearranger\else{\thearranger}\\ \fi
+          \ifx\lilypondcomposer\undefined\else{\large\normalfont\scshape\lilypondcomposer\\}\fi
+          \ifx\lilypondopus\undefined\else{\lilypondopus\\}\fi
+          \ifx\lilypondarranger\undefined\else{\lilypondarranger\\}\fi
         \end{flushright}%
   \end{minipage}\par
   \parskip\saveparskip
-  {\center{\large\theinstrument}\par}
-  {\flushleft{\large\normalfont\scshape\thepiece}}
+  \ifx\lilypondinstrument\undefined\else{\center{\large\lilypondinstrument}\par}\fi
+  \ifx\lilypondpiece\undefined\else{\flushleft{\large\normalfont\scshape\lilypondpiece}\par}\fi
 %  \leavevmode
+  \global\let\lilypondopus\relax%
+  \global\let\lilypondpiece\relax%
+  \global\let\mustmakelilypondtitle\undefined%
 }
-\def\makelilypiecetitle
+%
+\def\makelilypondpiecetitle
 {
-  \bigskip
-  {\flushright{\theopus}\par}
-  {\flushleft{\large\normalfont\scshape\thepiece}}
+  \bigskip\myfilbreak
+  \ifx\lilypondopus\undefined\else{\flushright{\lilypondopus}\par}\fi
+  \ifx\lilypondpiece\undefined\else{\flushleft{\large\normalfont\scshape\lilypondpiece}\par}\fi
+  \nopagebreak%
+  \global\let\lilypondopus\relax%
+  \global\let\lilypondpiece\relax%
+  \global\let\mustmakelilypondpiecetitle\undefined%
+}
+% header -- head ?
+% these names can't be changed: they're uses in mutopia headers
+\def\theheader
+{
+  \ifx\lilypondhead\undefined\relax\else%
+    \lilypondhead\fi
+}
+\def\thefooter
+{
+  \ifx\lilypondfooter\undefined\relax\else%
+    \lilypondfooter\fi
 }
+\def\makelilypondtagline
+{
+  \ifx\undefined\lilypondtagline\relax\else\lilypondtagline\fi
+}
+\def\thecopyright
+{
+  \ifx\lilypondcopyright\undefined\thefooter\else%
+    \lilypondcopyright\fi
+}
+%
+% Moved header and footer definitions here from the ly2dvi script.
+% Separate page styles for first, last and ordinary (plain) pages.
+\makeatletter
+\renewcommand{\ps@plain}{
+  \renewcommand{\@oddfoot}{\parbox{\textwidth}{\mbox{}\thefooter}}%
+  \renewcommand{\@evenfoot}{\@oddfoot}%
+  \renewcommand{\@evenhead}{\hbox to\textwidth{\textbf{\thepage}\hfill{\small\theheader}}}
+  \renewcommand{\@oddhead}{\hbox to
+  \textwidth{{\small\theheader}\hfill\textbf{\thepage}}}}
+\newcommand{\ps@firstpage}{
+  \renewcommand{\@oddfoot}{\parbox{\textwidth}{\mbox{}\thecopyright}}%
+  \renewcommand{\@evenfoot}{\@oddfoot}}
+\newcommand{\ps@lastpage}{
+  \renewcommand{\@oddfoot}{\parbox{\textwidth}{\mbox{}\makelilypondtagline}}%
+  \renewcommand{\@evenfoot}{\@oddfoot}}
+\makeatother
 \endinput