]> git.donarmstrong.com Git - lilypond.git/blobdiff - tex/titledefs.tex
* tex/titledefs.tex: Replaced \ifx\blabla\undefined
[lilypond.git] / tex / titledefs.tex
index 51df6979e71724cd23abb7f16e055039795bb9b4..3ca748c76401fbd05b12f5556bccb5bd27e87a65 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{}
-\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*{\mudelapoet}[1]{\def\thepoet{#1}}
-%
-%
-\def\mudelanull{}%
-%
-\def\makelilytitle{%
+\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}
-        \bfseries
-        \ifx\mudelanull\thetitle\else\sethuge{\thetitle}\\ \fi
-        \ifx\mudelanull\thesubtitle\else\setLarge{\thesubtitle}\\ \fi
+    \lilypondifundefined{lilyponddedication}
+    {}
+    {\normalfont\lilyponddedication\\}
+    
+    \bfseries
+    
+    \lilypondifundefined{lilypondtitle}
+    {}
+    {\huge\lilypondtitle\\}
+    
+    \lilypondifundefined{lilypondsubtitle}
+    {}
+    {\Large\lilypondsubtitle\\}
+    
+    \lilypondifundefined{lilypondsubsubtitle}
+    {}
+    {\large\lilypondsubsubtitle\\}
   \end{center}
+  
   \bigskip
-  % urg
-  \edef\saveparskip{\parskip}\parskip-5mm
+  
   \begin{minipage}[t]{0.45\textwidth}
-        \ifx\mudelanull\thepoet\else\settext{\thepoet}\\ \fi
-        \ifx\mudelanull\themetre\else\settext{\themetre}\\ \fi
-  \end{minipage}\hspace*{\fill}
+    \lilypondifundefined{lilypondpoet}
+    {}
+    {\lilypondpoet\\}
+    
+    \lilypondifundefined{lilypondtexttranslator}
+    {}
+    {\lilypondtexttranslator\\}
+    
+    \lilypondifundefined{lilypondmeter}
+    {}
+    {\lilypondmeter\\}
+  \end{minipage}
+  
+  \hspace*{\fill}
+  
   \begin{minipage}[t]{0.45\textwidth}
-      \begin{flushright}
-          \ifx\mudelanull\thecomposer\else\setlarge{\normalfont\scshape\thecomposer}\\ \fi
-          \ifx\mudelanull\theopus\else\settext{\theopus}\\ \fi
-          \ifx\mudelanull\thearranger\else\settext{\thearranger}\\ \fi
-        \end{flushright}%
-  \end{minipage}\par
-  \parskip\saveparskip
-  {\center\setlarge{\theinstrument}\par}
-  {\flushleft\setLarge{\normalfont\scshape\thepiece}}
-  \leavevmode
+    \begin{flushright}
+      \lilypondifundefined{lilypondcomposer}
+      {}
+      {\large\normalfont\scshape\lilypondcomposer\\}
+      
+      \lilypondifundefined{lilypondopus}
+      {}
+      {\lilypondopus\\}
+      
+      \lilypondifundefined{lilypondarranger}
+      {}
+      {\lilypondarranger\\}
+    \end{flushright}
+  \end{minipage}
+  
+  \par
+  
+  \lilypondifundefined{lilypondinstrument}
+  {}
+  {\center{\large\lilypondinstrument}
+    \par}
+  
+  \lilypondifundefined{lilypondpiece}
+  {}
+  {\flushleft{\large\normalfont\lilypondpiece}
+    \par}
+  
+% \leavevmode
+
+  \global\let\lilypondopus\undefined
+  \global\let\lilypondpiece\undefined
+  \global\let\mustmakelilypondtitle\undefined
 }
-\def\makelilypiecetitle
-{
-  \bigskip
-  {\flushright\settext{\theopus}\par}
-  {\flushleft\setLarge{\normalfont\scshape\thepiece}}
+
+\def\makelilypondpiecetitle{
+  \bigskip\myfilbreak
+
+  \lilypondifundefined{lilypondopus}
+  {}
+  {\flushright{\lilypondopus}
+    \par}
+  
+  \lilypondifundefined{lilypondpiece}
+  {}
+  {\flushleft{\large\normalfont\scshape\lilypondpiece}
+    \par}
+  
+  \nopagebreak
+
+  \global\let\lilypondopus\undefined
+  \global\let\lilypondpiece\undefined
+  \global\let\mustmakelilypondpiecetitle\undefined
+}
+
+% header -- head ?
+% these names can't be changed: they're used in mutopia headers
+
+\def\theheader{
+  \lilypondifundefined{lilypondhead}
+  {}
+  \lilypondhead
 }
-\endinput
 
+\def\thefooter{
+  \lilypondifundefined{lilypondfooter}
+  {}
+  \lilypondfooter
+}
+
+\def\makelilypondtagline{
+  \lilypondifundefined{lilypondtagline}
+  {}
+  \lilypondtagline
+}
+
+\def\thecopyright{
+  \lilypondifundefined{lilypondcopyright}
+  \thefooter
+  \lilypondcopyright
+}
+
+% Moved header and footer definitions here from the lilypond 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