]> git.donarmstrong.com Git - lilypond.git/blobdiff - tex/titledefs.tex
front port
[lilypond.git] / tex / titledefs.tex
index 9cd871e4d90b3129eff7e9996cf0b25257ae386e..9894742ba4cba42386f790fb0f038e988fb1d5a2 100644 (file)
+% titledefs.tex
 %
-% ideally, we should create a LaTeX/TeX class
-% for setting music in different sizes.
+% LilyPond titling for LaTeX
 %
-% Version 0.1
+% Note:
 %
-\input lilyponddefs
-\def\EndLilyPondOutput{\endinput}
+%    Defining a value, but leaving it empty:
+%        \def\lilypondfoo{}
+%    makes LaTeX break on the \\ in:
+%        \ifx\lilypondfoo\undefined\else{\lilypondfoo\\}\fi
 %
-\def\thetitle{}
-\def\thesubtitle{}
-\def\thecomposer{}
-\def\thearranger{}
-\def\theinstrument{}
-%
-\newcommand*{\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*{\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}}
-%
-\def\makelilytitle
-{
-  {\center\bfseries\huge\center\thetitle}
-        \par
-       {\center\bfseries\large\thesubtitle}
-  %\bigskip
-  {\flushleft\theinstrument\hfill\scshape\thecomposer}{\hfill\thearranger}
+\edef\titledefsELC{\the\endlinechar}%
+\endlinechar -1\relax
+
+% The feta characters for use in titles
+\input feta20.tex
+
+\font\fetasixteen=feta16
+\def\fetafont{\fetasixteen}
+\def\fetachar#1{\hbox{\fetasixteen#1}}
+
+\def\makelilypondtitle{
+  \begin{center}
+    \ifx\lilyponddedication\undefined
+    \else
+      {\normalfont\lilyponddedication\\}
+    \fi
+
+    \bfseries
+
+    \ifx\lilypondtitle\undefined
+    \else
+      {\huge\lilypondtitle\\}
+    \fi
+
+    \ifx\lilypondsubtitle\undefined
+    \else
+      {\Large\lilypondsubtitle\\}
+    \fi
+
+    \ifx\lilypondsubsubtitle\undefined
+    \else
+      {\large\lilypondsubsubtitle\\}
+    \fi
+  \end{center}
+
+  \bigskip
+
+  \begin{minipage}[t]{0.45\textwidth}
+    \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\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
+
+  \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\makelilypondpiecetitle{
+  \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 used in mutopia headers
+
+\def\theheader{
+  \ifx\lilypondhead\undefined
+  \else
+    \lilypondhead
+  \fi
+}
+
+\def\thefooter{
+  \ifx\lilypondfooter\undefined
+  \else
+    \lilypondfooter
+  \fi
+}
+
+\def\makelilypondtagline{
+  \ifx\undefined\lilypondtagline
+  \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
+
+\endlinechar \titledefsELC
 \endinput