- {
- %% either plain TeX or texinfo or not at the beginning of LaTeX input
- \def\x{\endgroup}}
- {
- %% FIXME: a4
- %% provide a proper LaTeX preamble (for A4 paper format)
- \def\x{
- \endgroup
- \def\lilyponddocument{}
- \documentclass[a4paper]{article}
- %% safe-mode
- \nofiles
- \pagestyle{empty}
- \lilypondifundefined{lilypondclassic}
- {
- %% Nullify [La]TeX page layout settings, page layout by LilyPond.
+ {%% Either plain TeX or texinfo or not at the beginning of LaTeX input.
+ \def\x{
+ \endgroup
+
+ \def\lilypondfontencoding####1{
+ \lilypondECencoding}
+ \def\lilypondpagebreak{
+ \eject}
+ \def\lilypondnopagebreak{
+ \ifvmode
+ \penalty 10000\relax
+ \fi}}}
+
+ {%% LaTeX mode: Provide a complete preamble.
+ \def\x{
+ \endgroup
+
+ %% Indicate that we shall emit `\end{document}' while executing
+ %% \lilypondend.
+ \def\lilyponddocument{}
+
+ \def\lilypondfontencoding####1{
+ \fontencoding{####1}
+ \selectfont}
+ \def\lilypondpagebreak{
+ \newpage}
+ \def\lilypondnopagebreak{
+ \nopagebreak}
+
+ \documentclass[\lilyponddocumentclassoptions]{article}
+
+ %% As a safety guard, don't produce auxiliary files.
+ \nofiles
+
+ %% FIXME: workaround non-existent TeX.def.
+ \def\TeXdef{TeX}\ifx\TeXdef\lilypondpaperinputencoding
+ \usepackage[latin1]{inputenc}
+ \else
+ \usepackage[\lilypondpaperinputencoding]{inputenc}
+ \fi
+ \pagestyle{empty}
+
+ \usepackage{color}
+
+ \lilypondifundefined{lilypondclassic}
+ {%% If not in `classic' mode, undo LaTeX's page layout settings
+ %% since LilyPond does the layout by itself.