X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=tex%2Flilyponddefs.tex;h=5cc6d4ffcf95e3b7b6172efe765fad235816cfaa;hb=365965540333eb846c417f94c2a2c8a5578b2d52;hp=5ef348b4dd8af43ea2bd2d3775c9fcca5a5ef7b6;hpb=434da79e9d7684b2b05fa92a6d808d4ea7933046;p=lilypond.git diff --git a/tex/lilyponddefs.tex b/tex/lilyponddefs.tex index 5ef348b4dd..5cc6d4ffcf 100644 --- a/tex/lilyponddefs.tex +++ b/tex/lilyponddefs.tex @@ -1,200 +1,205 @@ -%% -%% include file for LilyPond -%% -%% this file defines various macros to accomodate lilypond output -%% -%% let's not make par before endinput +% lilyponddefs.tex % -% TeXbook ex 7.7 -\def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax} +% Include file for LilyPond. % -% skip if included already -\def\SkipLilydefs{\endinput} -\ifundefined{EndLilyPondOutput} - \def\EndLilyPondOutput{\csname bye\endcsname} - \def\SkipLilydefs{} -\fi -\SkipLilydefs +% This file defines various macros to acommodate lilypond output. % -\ifundefined{mudelacopyright} - \def\mudelacopyright{\copyright\ \number\year} -\fi -\ifundefined{mudelatagline} - \def\mudelatagline{Lily was here} -\fi -\ifundefined{documentclass} - \input lilypond-plaintex -\else - \input lilypond-latex -\fi - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% macros to shorten other definitions -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\musicmathdef#1#2{\def#1{\musicmathchar{#2}}} -\def\musicmathchar#1{\musicmathfont\char#1} - -\def\topalign#1{\vbox to 0pt{#1\vss}} -\def\botalign#1{\vbox to 0pt{\vss #1}} - -\def\centeralign#1{\hbox to 0pt{\hss#1\hss}} -\def\leftalign#1{\hbox to 0pt{#1\hss}} -\def\rightalign#1{\hbox to 0pt{\hss#1}} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% set up dimensions -% mudela-book don't like this: -%\parindent=0pt -\newdimen\interlinedist - -\newcount\n %duh. meaningful identifiers. -\newdimen\staffheight -\newdimen\stafflinethickness - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% set fonts and primary dimensions - +% It should run with plain TeX, LaTeX, pdftex, and texinfo. % -% TODO JUNK THIS +% To avoid interferences, lilyponddefs.tex should be loaded within a group. +% To load it only once, most of the definitions must be global. % -% ugh -\def\cmrtwenty{ - \font\smalltextfont=cmr8 - \font\textmusic=cmmi12 -} -\def\cmrsixteen{ - \font\smalltextfont=cmr6 - \font\textmusic=cmmi10 - } -\def\cmrthirteen{ - \font\smalltextfont=cmr6 - \font\textmusic=cmmi9 - } -\def\cmreleven{ - \font\smalltextfont=cmr5 - \font\textmusic=cmmi8 - } -%%%%%%% +% The overall structure of a file created by LilyPond is as follows: % -\def\musixtwentydefs{ - \twentyfonts - \csname cmrtwenty\texsuffix\endcsname - \musixcalc -} - -\def\musixsixteendefs{ - \sixteenfonts - \csname cmrsixteen\texsuffix\endcsname - \musixcalc - } -\def\musixtwentysixdefs{ - \csname cmrtwentysix\texsuffix\endcsname - \twentysixfonts - \musixcalc - } -\def\musixthirteendefs{ - \thirteenfonts - \csname cmrthirteen\texsuffix\endcsname - \musixcalc -} -\def\musixelevendefs{ - \csname cmreleven\texsuffix\endcsname - \elevenfonts - \musixcalc -} - -\def\textsharp{\raise.4ex\hbox{\textmusic\char"5D}} -\def\textnatural{\raise.4ex\hbox{\textmusic\char"5C}} -\def\textflat{\raise.2ex\hbox{\textmusic\char"5B}} - +% +% \ifx\lilypondstart \undefined +% \input lilyponddefs +% \fi +% \lilypondstart +% +% \lilypondend +% +% No footers and headers are provided for the stand-alone run (i.e., for +% directly saying `latex '. +% +% +% Avoid \par while reading this file. +\edef\lilyponddefsELC{\the\endlinechar}% +\endlinechar -1\relax +% the next three macros are taken from LaTeX +\long\gdef\lilypondfirst#1#2{#1} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% do derivative calcs +\long\gdef\lilypondsecond#1#2{#2} -% this has to be synced with the font definition -\def\musixcalc{ +\gdef\lilypondifundefined#1{ + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\lilypondfirst + \else + \expandafter\lilypondsecond + \fi +} - \stafflinethickness=\mudelapaperrulethickness pt +\gdef\lilypondstart{ + \begingroup + \catcode `\@=11\relax + % \@nodocument is defined as \relax after `\begin{document}' + \lilypondifundefined{@nodocument} + { + % either plain TeX or texinfo or not at the beginning of LaTeX input + \def\x{\endgroup} + } + { + % provide a proper LaTeX preamble (for A4 paper format) + \def\x{ + \endgroup + \def\lilyponddocument{} + \documentclass[a4paper]{article} + \nofiles + \pagestyle{empty} + % \begin is defined as \outer in texinfo, thus we use \csname + \csname begin\endcsname{document} + % center staves horizontally on page + \ifdim\lilypondpaperlinewidth\lilypondpaperunit > 0pt + \hsize\lilypondpaperlinewidth\lilypondpaperunit + % we abuse \scoreshift temporarily + \scoreshift \paperwidth + \advance\scoreshift -\the\hsize + \scoreshift 0.5\scoreshift + \advance\scoreshift -1in + \oddsidemargin \scoreshift + \evensidemargin \scoreshift + \fi + \parindent 0pt + } + } + + \x + + \lilypondifundefined{mustmakelilypondtitle} + {} + {\makelilypondtitle} + + \lilypondifundefined{mustmakelilypondpiecetitle} + {} + {\makelilypondpiecetitle} } +\gdef\lilypondend{ + \lilypondifundefined{lilypondbook} + {\lilypondifundefined{lilypondpaperlastpagefill} + {\vskip 0pt plus \lilypondpaperinterscorelinefill00 fill} + {} + } + {} + + \begingroup + \lilypondifundefined{lilyponddocument} + { + \def\x{\endgroup} + } + { + \def\x{ + \endgroup + \csname end\endcsname{document} + } + } + + \x +} +% this is an inversed \loop ... \repeat macro +\def\lilypondloop#1\lilypondrepeat{ + \def\lilypondbody{#1} + \lilyponditerate +} -% stacked horizontal lines -\def\interscoreline{\vskip 16pt} +\def\lilyponditerate{ + % \if ... + \lilypondbody + \let\lilypondnext \relax + \else + \let\lilypondnext \lilyponditerate + \fi + \lilypondnext +} -% big fat marks, if errors are detected. -\def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}} -\def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}} -\def\errormark{{\bf E!}} -\def\unknown{% - %{\bf u} %FIXME +% the following macro is executed only once +\gdef\lilypondspecial{ + \special{header=music-drawing-routines.ps} + \gdef\lilypondspecial{} } -\input fetdefs +% the feta characters +\input feta20 +\global\font\fetasixteen = feta16 +\gdef\fetafont{\fetasixteen} +\gdef\fetachar#1{\hbox{\fetasixteen#1}} -% ugh -% see e.g. input/test/beam-pos.ly -% -% something's wrong with the aligment; sometimes all symbols -% look to be placed a bit too high (there's an ugly fix for -% the staccato-dot in script.cc) -% but this varies from line to line: it seems that xdvi -% does some rounding; i can't really check this from screen on i -% 600x600 res. -% -\def\rulesym#1#2{\dimen0=#1 %obsolete - \vrule height .5\dimen0 depth .5\dimen0 width #2} -\def\shiftedrulesym#1#2{\dimen0=#1% - \vrule height .7\dimen0 depth .3\dimen0 width #2} -\def\tinyrulesym#1#2{\dimen0=#1% - \vrule height .1\dimen0 depth .1\dimen0 width #2} -%would be nice for checking alignment -\def\openrulesym#1#2{\dimen0=#1% - \vbox to \dimen0{\vss% - \hbox{\vrule height .1\dimen0 width #2}% - \hbox{\vrule height .2\dimen0 width 0pt}% - \hbox{\vrule height .4\dimen0 width #2}% - \hbox{\vrule height .2\dimen0 width 0pt}% - \hbox{\vrule height .1\dimen0 width #2}% - \vss}} -%\let\rulesym\shiftedrulesym -%\let\rulesym\tinyrulesym -%\let\rulesym\openrulesym - -% the interline symbol. Redefine to remove it. -\def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}} -\def\lineseparator{\defaultlineseparator} -\def\beauty{% - \par\vskip 10pt plus 30pt minus 10pt\par - \hskip -5pt\lineseparator - \par\vskip 10pt plus 30pt minus 10pt\par +\gdef\botalign#1{ + \vbox to 0pt{\vss #1} +} +\gdef\leftalign#1{ + \hbox to 0pt{#1\hss} } +\gdef\lyitem#1#2#3{ + \botalign{ + \hbox{\raise #1\outputscale + \leftalign{\kern #2\outputscale #3}} + } +} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\postheader{} - -% -% macros suck. \ifundefined{nolilyfooter} gives wierd errors from time -% to time. -% +\gdef\lybox#1#2#3{ + \hbox to #1\outputscale { + \lower\scoreshift \vbox to #2\outputscale { + \hbox{#3} + \vss + } + \hss + } +} -% -% Warning: the order is conceptually weird. It says: +\gdef\lyvrule#1#2#3#4{ + \kern #1\outputscale + \vrule width #2\outputscale depth #3\outputscale height #4\outputscale +} -% if not defined (``nolilyfooter''): -% do_footer () -% else -% dont_do_footer () +% Attempt to keep lilypiecetitle together with the piece: % -\ifx\csname nolilyfooter\endcsname\relax - \message{[footer defined]}% - \csname lilyfooter\texsuffix\endcsname% -\else - \message{[footer empty]} - \csname% - nolilyfooter\texsuffix\endcsname -\fi +% TODO: figure this out. +\gdef\myfilbreak{}%\par\vfil\penalty200\vfilneg} + +\lilypondifundefined{lilypondpaperinterscorelinefill} + {\gdef\lilypondpaperinterscorelinefill{0}} + {\gdef\lilypondpaperinterscorelinefill{1}} + +%% Allow overriding of interscoreline, eg for lilypond --preview +\lilypondifundefined{interscoreline} +{\gdef\interscoreline{ + \vskip \lilypondpaperinterscoreline \lilypondpaperunit + plus \lilypondpaperinterscorelinefill fill +}}{} + +% Are we using PDFTeX? If so, use pdf definitions. +% MiKTeX checks \pdfoutput the wrong way, thus we use \csname. +\lilypondifundefined{lilypondpostscript} + { + \lilypondifundefined{pdfoutput} + {\input lily-ps-defs } + { + \pdfoutput = 1 + \input lily-pdf-defs % + } + } + {} + +\newdimen\outputscale +\newdimen\scoreshift + +% Restore newline functionality (disabled to avoid \par). +\endlinechar \lilyponddefsELC +\endinput + +% EOF