Debian Codegraph @

utils/pmx/pmx-src/pmx.tex

raw
1 %%%%%%%%%%%%%%%%%%%%%%%
2 %% %%
3 %% pmx.tex %%
4 %% %%
5 %%%%%%%%%%%%%%%%%%%%%%%
6 \ifx\pmxversion\undefined\else\endinput\fi
7 \def\pmxversion{2.94}\def\pmxdate{23 Jan 20}
8 % 2.94 add def'ns of \hbp, \hbpp
9 % 2.80 add def'n of \slx, real stemlength
10 % 2.73 4 Feb 16 Fix \pmxclefsym to include \smalltreblelowoct
11 % 2.73 Added \pmxlyr command.
12 % 2.619 At movement break, directly set \nbinstruments in \newmovement;
13 % probably don't need \newnoi any more.
14 % (2.619a) Added \resetlyrics in \newmovement.
15 % 2.614 Comment out definitions of some dotted rests, since either in
16 % musixtex.tex or not needed.
17 % Modified for two figured bass lines 081115
18 % 2.502 (Olivier Vogel) change all the commands of the form
19 % \font\...=\fontid sy1000 to \font\...=cmsy10
20 % 2.408 comment out extra definition of \mdot
21 % tweak \hpausep, replace \liftPAuse, add \liftPAusep
22 % 2.406 redefine \starteq to put down strut for first system inside \znotes
23 % 2.354a add \zcharnote{##2}{~} to \tieforsl
24 % 2.354
25 % Macros \tieforisu, etc, to replace slurs with ties, for use with musixps
26 % 2.353
27 % Define \pmxversion
28 % Insert Dirk's 2nd set of (LaTeX-aware) redefinitions for \centerline etc.
29 % Add 5th option for \endset to \newmovement, for Rz.
30 % 12/24/01 add \setzalaligne
31 % 12/23/01 Remove \parskip re-definition.
32 % 12/16/01 Define \psforts (postscript slur endings to replace \midslur)
33 % 10/20/01 added defn's of \bigcna, etc
34 % 10/20/01 define \resetsize, redefine \gaft, \grace, and \shlft so resizing
35 % is conditional on current staff line spacing.
36 % 11 September Redefine liftpausc to include ledger line.
37 % 26 Aug 01 Add \pcaesura, \pbreath
38 % 10/21/00 Added PMXbarnotrue/false and stopped PMX zapping writezbarno
39 % 15 October added vertical equalization macros
40 % 4 July added \PAusep, \brevep, dynamic mark placement \pmxdyn, \sfz
41 % 1 July inserted stuff for hairpins
42 % 31 May 99 Redefined \smno
43 %
44 \immediate\write10%
45 {PMX, a Preprocessor for MusiXTeX, Version\space\pmxversion b\space<\pmxdate>}%
46 % Check for MusiXTeX version. TeX generates an error, not an ordinary
47 % \end, because the \ifnum is not completed.
48 \ifnum\mxvernumber<121\immediate\write16{ }
49 \immediate\write16{****************}
50 \immediate\write16{! STOPPING TeX because MusiXTeX Version = \mxvernumber}
51 \immediate\write16{ while PMX 2.71+ requires at least 121}
52 \immediate\write16{****************}
53 \immediate\write16{ }\end{document}\fi
54 %
55 \edef\catcodeat{\the\catcode`\@}\catcode`\@=11
56 %
57 % The next 4 lines are for Don's home use only
58 %
59 \font\specfnt=cmssqi8%
60 \def\mtr#1{\zcharnote{#1}%
61 {\specfnt\kern 1.5\internote\raise 0.3\internote\hbox to 0pt{/\hss}%
62 \kern -0.7\internote\raise 1.0\internote\hbox to 0pt{/\hss}}}
63 %
64 \newif\ifolder%
65 %
66 % Older fonts had clefs at different heights. If you have the older
67 % version you should uncomment the following line
68 %\oldertrue%
69 %
70 % The next 3 lines should be in musixmad. They were omitted in
71 % some early versions!
72 %
73 %\newcount\s@Nx
74 %\newcount\s@Nxi
75 %\newcount\s@Nxii
76 %
77 % Stemlength macro shorthands for 2-note unbeamed tremolos
78 %
79 \def\slx#1{\stdstemfalse\nostemcut\stemlength{#1}}
80 \def\slz{\stemcut\stemlength{4.66}}
81 %
82 % Special clef change stuff
83 %
84 \newcount\reflect
85 \def\pmxnewclefs{\m@loop\s@l@ctclefs\o@c\a@c\repeat}%
86 \newtoks\pmxclefsym
87 \def\pmxclef#1#2{\ifnum#1=0\def\pmxclefsym{\smalltrebleclef}\else\ifnum#1<5%
88 \def\pmxclefsym{\smallaltoclef}\else\ifnum#1=7\def\pmxclefsym{\smalltrebleclef}%
89 \else\ifnum#1=8\def\pmxclefsym{\smalltreblelowoct}%
90 \else\def\pmxclefsym{\smallbassclef}\fi\fi\fi\fi%
91 % Adjust height here for older clef default heights.
92 \reflect#2\ifolder\ifnum#1=0\advance\reflect-2\else\ifnum#1<5\advance\reflect-4%
93 \else\advance\reflect-6\fi\fi\fi%
94 \lcharnote{0}{\raise\reflect\internote\hbox{\pmxclefsym}}}%
95 %
96 % Grace note stuff, incl. macro to reset size after going tiny.
97 % This may assume that \musicsize is 20pt but some staves may have
98 % \setsize#1\smallvalue
99 %
100 \def\resetsize{\ifdim\internote<.95\Internote%
101 \let\musictinyfont\musicthirteen\smallnotesize\else\normalnotesize\fi}%
102 \def\settiny{\ifdim\internote<.95\Internote\let\musictinyfont\musiceleven\fi%
103 \tinynotesize}%
104 \def\grace#1#2#3{\off{-#1pt}\settiny\stdstemfalse#2\zcu{#3}%
105 \resetsize\off{#1pt}}%
106 \def\shlft#1#2{\off{-#1pt}\settiny\stdstemfalse#2\resetsize\off{#1pt}}%
107 \def\gaft#1#2{\bsk\roffset{#1}{{\settiny\stdstemfalse#2\resetsize}}\sk}%
108 %
109 % The following keep octaviation out of brackets.
110 % 10/20/01: Are these used anywhere???
111 %
112 %\def\Gshl#1{\off{-#1pt}\tinynotesize}%
113 %\def\Gshr#1{\normalnotesize\off{#1pt}}%
114 \def\segnoo#1#2{\zcharnote{#2}{\kern#1pt\musicsmallfont\char"56}}%
115 \def\ssegno#1{\zcharnote{#1}{\musictinyfont\char86}}%
116 %
117 % Some ornaments...
118 %
119 % Font for x-trill symbol. Could make this more general.
120 %
121 \def\xtr#1{\zcharnote{#1}{\xtrfont\char"02}}
122 %
123 % Plus-trill
124 %
125 \def\ptr#1{\ptrx{#1}{1.8}{.35}}
126 \def\ptrx#1#2#3{\zcharnote{#1}{\raise.9\internote\hbox{%
127 \pcil\h@lf\qn@width\kern\pcil%
128 \razclef#2\internote\pcil#3\internote\kern-\h@lf\razclef\vrule height \h@lf\pcil
129 depth \h@lf\pcil width \razclef\kern-\h@lf\razclef\kern-\h@lf\pcil\kern-.1pt
130 \vrule height \h@lf\razclef depth \h@lf\razclef width \pcil}}%
131 }%
132 %
133 % Put in a number for an xtuplet.
134 %
135 \def\xnum#1#2#3{\off{#1\elemskip}\zcharnote{#2}{\smalltype\it #3}%
136 \off{-#1\elemskip}}
137 %
138 % accidental skips
139 %
140 \def\ast#1{\off{#1\elemskip}}
141 %
142 % Check for and read a .mod file; open the .ask file
143 %
144 \newread\pmxmod
145 \def\readmod#1{\openin\pmxmod #1.mod\relax
146 \ifeof\pmxmod\else\input #1.mod\fi\closein\pmxmod}
147 %
148 % Macros for optional small notes, usually w/ down stems. Offset to center
149 % them below a large note. I used these in Matteis.
150 %
151 %\def\smno#1{\roffset{.17}{\tinynotesize#1\normalnotesize}}%
152 %
153 % Redefined, due to some mysterious problem with \roffset
154 %
155 \def\smno#1{\off{.17\qn@width}\tinynotesize#1\normalnotesize\off{-.17\qn@width}}%
156 \def\pmno#1{\roffset{.08}{\smallnotesize#1\normalnotesize}}%
157 \def\smq#1{\smno{\zql{#1}}}\def\smc#1{\smno{\zcl{#1}}}%
158 \def\smh#1{\smno{\zhl{#1}}}%
159 %
160 % Single-digit meter symbol
161 %
162 \newbox\workbox%
163 \def\meterN#1{\setbox\workbox=\vbox{\hbox{\ \meterfont #1}}%
164 \vbox to 8\internote{\offinterlineskip\vss\hbox to \wd\workbox{\hss
165 \meterfont #1\hss}\vss }}%
166 %
167 % Meter symbol '3' with vertical slash
168 %
169 \def\meterIIIS{\kern\internote\raise\Interligne\hbox{\meterfont 3}%
170 \kern -2.0\internote
171 \vrule height 7\internote depth -\internote width0.3\internote
172 \kern 1.7\internote}%
173 %
174 % Fractional meter with a slash
175 %
176 \def\meterfracS#1#2{%
177 \kern\internote\raise2\Interligne\rlap{\meterfont #1}%\lower2\Interligne%
178 \hbox{\meterfont #2}%
179 \kern -1.85\internote
180 \vrule height 8\internote width0.3\internote
181 \kern 1.55\internote}%
182 %
183 % *Symbols* for use in figures
184 %
185 \def\sharpfig{\musixchar92}
186 \def\flatfig{\musixchar90}
187 \def\natfig{\musixchar94}
188 \def\fsmsh{\llap{\musixchar92}}
189 \def\fsmfl{\llap{\musixchar90}}
190 \def\fsmna{\llap{\musixchar94}}
191 %
192 % Macros for editorial accidentals
193 %
194 \def\qedit#1{\roffset{.2}{\zcharnote{#1}{\normtype\rm?}}}
195 \def\qsharp#1{%
196 \loffset{.2}{\zcharnote{#1}{\sharpfig\lower1.3\internote\hbox{\normtype\rm?}}}}
197 \def\qflat#1{%
198 \loffset{.2}{\zcharnote{#1}{\flatfig\lower.8\internote\hbox{\normtype\rm?}}}}
199 \def\qnat#1{%
200 \loffset{.2}{\zcharnote{#1}{\natfig\lower1.2\internote\hbox{\normtype\rm?}}}}
201 \def\esharp#1{\roffset{.3}{\zcharnote{#1}{\sharpfig}}}
202 \def\eflat#1{\roffset{.3}{\zcharnote{#1}{\flatfig}}}
203 \def\enat#1{\roffset{.3}{\zcharnote{#1}{\natfig}}}
204 %
205 % Cautionary big accidentals
206 %
207 \def\bigcna{\cna} \def\bigcfl{\cfl} \def\bigcsh{\csh}
208 %
209 % Some fonts...for some reason my system can't do cmbx12 scaled \magstep4
210 % 9/17/97 Must redo the following 3 lines to permit EC/DC fonts
211 %
212 %\font\BIGfont=cmbx10 scaled\magstep4\font\Bigfont=cmbx10 scaled\magstep2
213 %\font\tempo=\fontid bx12%
214 %\font\dyn=\fontid bx10%
215 \iflongDCfontnames
216 \font\xtrfont=cmsy10
217 \font\tempo=\fontid bx1200
218 \font\dyn=\fontid bx1000
219 \else\iflongECfontnames
220 \font\xtrfont=cmsy10
221 \font\tempo=\fontid bx1200
222 \font\dyn=\fontid bx1000
223 \else
224 %\font\xtrfont=cmsy10
225 %\font\BIGfont=cmbx10 scaled\magstep4
226 %\font\Bigfont=cmbx10 scaled\magstep2
227 \font\xtrfont=cmsy10
228 % Definitions deleted per Bob Tennent's request 150726
229 %\font\BIGfont=\fontid bx10 scaled\magstep4
230 %\font\Bigfont=\fontid bx10 scaled\magstep2
231 \font\tempo=\fontid bx12%
232 \font\dyn=\fontid bx10%
233 \fi\fi
234 %
235 % Continuation figure
236 %
237 \def\Cont#1#2{\advance\figdrop by #1\lower\figdrop\internote%
238 \hbox to \z@{\kern -0.3\noteskip%
239 \vbox{\hrule height 1.4\lthick width #2\noteskip}\hss}%
240 \advance\figdrop by -#1}%
241 \def\Cott#1#2{\advance\figdtwo by #1\lower\figdtwo\internote%
242 \hbox to \z@{\kern -0.3\noteskip%
243 \vbox{\hrule height 1.4\lthick width #2\noteskip}\hss}%
244 \advance\figdtwo by -#1}%
245
246 %
247 % Tiny C clef on line #1: Will need to mod with new fonts 11-4-96
248 %
249 \newdimen\razclef\newdimen\symwid%
250 \newdimen\pcil %\ifnum\musicsize=20\pcil4pt\else\pcil3.25pt\fi%
251 \def\preclef#1#2{%
252 \ifnum#2=20\pcil4pt\else\pcil3.25pt\fi%
253 \symwid3.692\pcil%
254 \hbox{\vbox{\hrule height \lthick width \symwid}%
255 \kern-\symwid\raise\pcil\vbox{\hrule height \lthick width \symwid}%
256 \kern-\symwid\raise2\pcil\vbox{\hrule height \lthick width \symwid}%
257 \kern-\symwid\raise3\pcil\vbox{\hrule height \lthick width \symwid}%
258 \kern-\symwid\raise4\pcil\vbox{\hrule height \lthick width \symwid}%
259 \razclef-2.43\pcil\advance\razclef#1\pcil%
260 \kern-\symwid\raise\razclef\hbox to \symwid{\hss\smallaltoclef\hss}%
261 }}%
262 \def\namewpc#1#2#3#4#5{\raise#4pt\hbox to \parindent{\raise#5pt\hbox{#1}%
263 \hfill\preclef{#2}{#3}}}
264 %
265 % Stuff for figure placements
266 %
267 % 9/17/97 redo font names
268 %
269 %\font\figfont=cmr10
270 \def\figfont{\normtype\rm}%
271 %
272 \newcount\figdrop
273 \newcount\figdtwo
274 %\figdrop=6
275 \newcount\sysno
276 \global\sysno=0\relax%
277 \def\Figu#1#2{\off{.9pt}\advance\figdrop by #1\lower\figdrop\internote%
278 \hbox to \z@{\figfont#2\hss}\off{-.9pt}\advance\figdrop by -#1}%
279 %
280 % Special Figure macro for 2-bass parts
281 %
282 %\def\Figt#1#2{\zcharnote{#1}{\kern.9pt\figfont#2}}%
283 \def\Figt#1#2{\off{.9pt}\advance\figdtwo by #1\lower\figdtwo\internote%
284 \hbox to \z@{\figfont#2\hss}\off{-.9pt}\advance\figdtwo by -#1}%
285 %
286 % Bar numbering
287 %
288 \systemnumbers%
289 \def\raisebarno{3.5\internote}%
290 \def\shiftbarno{3.5\internote}%
291 \newdimen\rbnbl\newdimen\sbnbl\newdimen\xrbn\newdimen\xsbn%
292 \newdimen\rbndim\newdimen\sbndim%
293 \global\rbndim\raisebarno\global\sbndim\shiftbarno%
294 \global\def\raisebarno{\rbndim}\global\def\shiftbarno{\sbndim}%
295 \global\rbnbl\rbndim\global\sbnbl\sbndim\global\xrbn0pt\global\xsbn0pt%
296 %
297 % The following 2 macros are messy, but they retain \raisebarno as a macro and
298 % retain original definition in musixtex for the end-of-line utility.
299 %
300 \def\bnrs#1#2{%
301 %
302 % If here, baseline values will not change. On exit, \rbndim will
303 % be the temporary value, \xrbn will be the increment (must save to check later;
304 % if <>0 then baseline hasn't changed!), and \rbnbl is still the baseline value.
305 %
306 \global\xrbn#1\internote\global\advance\rbndim\xrbn%
307 \global\xsbn#2\internote\global\advance\sbndim\xsbn%
308 }%
309 \def\writebarno{%
310 \ifnum\barno>1%
311 \boxit{\smalltype\bf\the\barno\barnoadd}%
312 \ifdim\raisebarno=\rbnbl%
313 \empty%
314 \else%
315 \ifdim\xrbn=0pt%
316 \global\rbnbl\raisebarno%
317 \global\def\raisebarno{\rbndim}%
318 \else%
319 \global\xrbn0pt%
320 \fi%
321 \global\rbndim\rbnbl%
322 \fi%
323 \ifdim\shiftbarno=\sbnbl%
324 \empty%
325 \else%
326 \ifdim\xsbn=0pt%
327 \global\sbnbl\shiftbarno%
328 \global\def\shiftbarno{\sbndim}%
329 \else%
330 \global\xsbn0pt%
331 \fi%
332 \global\sbndim\sbnbl%
333 \fi%
334 \fi%
335 }%
336 %
337 % Make small accidentals the default
338 %
339 \smallaccid%
340 %
341 % Put in a new time signature. Modified 151226
342 %
343 \def\newtimes#1%
344 {\ifnum#1=0%
345 \n@wbar\writ@newclefs\advance\barsinlin@\@ne%
346 %
347 % Added 151216
348 %
349 \wbarno@x\Writ@newsigns%
350 \advance\[email protected]\afterruleskip\widthtyp@\@ne\t@rmskip%
351 \Writ@meters\lastbarpos\lin@pos\addspace\afterruleskip%
352 \else\ifnum#1=1%
353 \alaligne
354 \else
355 \wbarno@x%
356 %
357 % Added 151226
358 %
359 \addspace\afterruleskip
360 %
361 % -0.7 gave too much space before meter.
362 %
363 % \advance\[email protected]\afterruleskip\widthtyp@\@ne\t@rmskip%
364 \advance\n@skip-\afterruleskip\widthtyp@\@ne\t@rmskip%
365 \Writ@meters\addspace\afterruleskip%
366 \fi\fi}%
367 %
368 % changecontext with no line break
369 %
370 \def\xchangecontext{\n@wbar\writ@newclefs
371 \wbarno@x\Writ@newsigns\Writ@meters\addspace\afterruleskip}%
372 %
373 % changecontext with forced line break and no barline
374 %
375 \def\zachangecontext{\advance\n@skip\beforeruleskip \widthtyp@\@ne \t@rmskip
376 \zn@wbar \writ@newclefs \advance\barsinlin@\@ne
377 \Writ@newsigns\z@suspend\contpiece }
378 %
379 % Dotted rests.
380 %
381 %\def\hsp{\pt7\hs}
382 %\def\hspp{\ppt7\hs}
383 %\def\qsp{\pt5\qs}\def\dsp{\pt5\ds}\def\qpp{\pt5\qp}
384 %\def\qspp{\ppt5\qs}\def\dspp{\ppt5\ds}\def\qppp{\ppt5\qp}
385 %\def\pausep{\off{.33\qn@width}\pt5\off{-.33\qn@width}\pause}
386 %\def\pausep{\wholeshift{\pt5}\pause}
387 \def\hpausepp{\wholeshift{\ppt5}\hpause}
388 \def\pausepp{\wholeshift{\ppt5}\pause}
389 %
390 % Redefine headline to lower pagenumber. The original defn:
391 % \def\makeheadline{\vbox to\z@{\vskip-22.5\p@
392 % \line{\vbox to8.5\p@{}\the\headline}\vss}\nointerlineskip}
393 %
394 \def\makeheadline{\vbox to\z@{\vskip-8\p@
395 \line{\vbox to8.5\p@{}\the\headline}\vss}\nointerlineskip}
396 %
397 % Dot at arbitrary height above a top line of staff
398 %
399 %\def\mdot#1{\zcharnote8{\kern-5.3pt\raise{#1}\internote\hbox{\musixchar0}}}
400 %
401 % Titles
402 %
403 %\def\titles#1#2#3#4#5#6#7{\kern-\lin@pos%
404 %\kern-3.2\Interligne\kern-\parindent\kern-\afterruleskip%
405 %\kern-\sign@skip%
406 %\vbox{\vskip#1\Interligne
407 %\ifx\relax#2\relax\else\leftline{\Bigtype #2}\fi\vskip#3\Interligne%
408 %\ifx\relax#4\relax\else\centerline{\BIGtype #4}\fi\vskip#5\Interligne%
409 %\ifx\relax#6\relax\else\rightline{\Bigtype #6}\fi\vskip#7\Interligne}}%
410 %
411 % New def'n per Dirk Laurie to allow multiple lines.
412 %
413 \ifx\documentclass\undefined
414 \def\centerlines#1{{\def\\{\hss\egroup\medskip\par\line\bgroup\hss}%
415 \line\bgroup\hss#1\hss\egroup}}
416 \def\leftlines#1{{\def\\{\hss\egroup\smallskip\par\line\bgroup}%
417 \line\bgroup#1\hss\egroup}}
418 \def\rightlines#1{{\def\\{\egroup\smallskip\par\line\bgroup\hss}%
419 \line\bgroup\hss#1\egroup}}
420 \else
421 \def\centerlines#1{{\centering#1\\}}
422 \def\leftlines#1{{\raggedright#1\\}}
423 \def\rightlines#1{{\raggedleft#1\\}}
424 \fi
425 %\def\centerline#1{{\def\\{\hss\egroup\medskip\par\line\bgroup\hss}%
426 % \line\bgroup\hss#1\hss\egroup}}
427 %\def\leftline#1{{\def\\{\hss\egroup\smallskip\par\line\bgroup}%
428 % \line\bgroup#1\hss\egroup}}
429 %\def\rightline#1{{\def\\{\egroup\smallskip\par\line\bgroup\hss}%
430 % \line\bgroup\hss#1\egroup}}
431 \def\titles#1#2#3#4#5#6#7{\kern-\lin@pos%
432 \kern-3.2\Interligne\kern-\parindent\kern-\afterruleskip%
433 \kern-\sign@skip%
434 \vbox{\vskip#1\Interligne
435 % Next 3 lines replaced at Bob Tennent's request 150726
436 %\ifx\relax#2\relax\else{\Bigtype\leftlines{#2}}\fi\vskip#3\Interligne%
437 %\ifx\relax#4\relax\else{\BIGtype\centerlines{#4}}\fi\vskip#5\Interligne%
438 %\ifx\relax#6\relax\else{\Bigtype\rightlines{#6}}\fi\vskip#7\Interligne}}%
439 \ifx\relax#2\relax\else{\bigtype\leftlines{#2}}\fi\vskip#3\Interligne%
440 \ifx\relax#4\relax\else{\BIgtype\centerlines{#4}}\fi\vskip#5\Interligne%
441 \ifx\relax#6\relax\else{\bigtype\rightlines{#6}}\fi\vskip#7\Interligne}}%
442 %
443 % Slashes on stems
444 %
445 \def\usoff#1{%
446 % Set \pcil to (stem length)-9\Internote
447 \ifnum#1>10
448 \pcil-3.8\Internote
449 \else
450 \pcil#1\Internote
451 \ifnum#1>3
452 \pcil-.38\pcil\advance\pcil-.5\Internote
453 \ifnum#1>7
454 \advance\pcil.38\Internote
455 \fi
456 \else
457 \ifnum#1<-2
458 \pcil-\pcil\advance\pcil-5\Internote
459 \else
460 \pcil-2\Internote
461 \fi
462 \fi
463 \fi
464 \advance\pcil#1\Internote
465 }%
466 %
467 \def\us#1{\usoff{#1}%
468 \raise\pcil\hbox{\loffset{.5}{\ibu009}\roffset{.5}{\tbu0}}}%
469 \def\ls#1{\reflect-#1\advance\reflect8 %
470 \usoff{\reflect}\advance\pcil-7\Internote%
471 \lower\pcil\hbox{\loffset{.5}{\ibl009}\roffset{.5}{\tbl0}}}%
472 %
473 % Thinner slashes, better coding
474 %
475 \newdimen\pmxtop\def\aslash#1#2#3{%
476 %
477 % #1 = note level relative to bottom line. #2 = 0/1 for down/up stem
478 % #3 = 0/1 for down/up slash, For downstem, reflect, do as up, then unreflect.
479 %
480 \ifcase#3\def\slchar{\char248}\or\def\slchar{\char184}\fi%
481 \ifcase#2\pmxtop-#1\internote\advance\pmxtop8\internote\or\pmxtop#1\internote%
482 \fi\advance\pmxtop4.66\interbeam\ifdim\pmxtop>11\internote\uptop{11}\uptop{12}%
483 \uptop{13}\uptop{14}\uptop{15}\uptop{16}\fi%
484 \ifdim\pmxtop<4\internote\pmxtop4\internote\fi%
485 %
486 % \pmxtop now top of stem for upstem. Unreflect if downstem
487 %
488 \ifcase#2\pmxtop-\pmxtop\advance\pmxtop8\internote\ifcase#3%
489 \advance\pmxtop2.5\internote\or\advance\pmxtop.9\internote\fi%
490 \ccharnote0{\raise\pmxtop\hbox{\musictinyfont\slchar}}%
491 \or\ifcase#3\advance\pmxtop-.9\internote\or\advance\pmxtop-2.5\internote\fi%
492 \roff{\ccharnote0{\raise\pmxtop\hbox{\musictinyfont\slchar}}}\fi}%
493 \def\uptop#1{\ifdim\pmxtop>#1\internote\advance\pmxtop-.25\interbeam\fi}%
494 %
495 % Signature change at end of line
496 %
497 \def\sigatend#1#2{\setdoublebar\xbar\hardspace{-#2pt}\generalsignature{#1}%
498 \zchangecontext\hardspace{-#2pt}\advance\barno-1\let\barrul@\empty}%
499 %
500 % Macros for beams
501 %
502 \def\rbbu#1{\roff{\tbbu{#1}}}
503 \def\rbbbu#1{\roff{\tbbbu{#1}}}
504 \def\rbbbbu#1{\roff{\tbbbbu{#1}}}
505 \def\rbbl#1{\roff{\tbbl{#1}}}
506 \def\rbbbl#1{\roff{\tbbbl{#1}}}
507 \def\rbbbbl#1{\roff{\tbbbbl{#1}}}
508 %
509 % Stuff for second voice per staff
510 %
511 \def\nextvoice{%
512 \@ndstaff\reflect\noport@@\advance\noport@@-1\beginstaff\noport@@\reflect}%
513 %
514 % Macros for moving slur starts and stops
515 %
516 \def\isu#1#2#3{\roffset{#3}{\isluru{#1}{#2}}}%
517 \def\isd#1#2#3{\roffset{#3}{\islurd{#1}{#2}}}%
518 \def\ts#1#2#3{\roffset{#3}{\tslur{#1}{#2}}}%
519 %
520 % Macro to replace old \tslur with special postscript slur endings
521 %
522 \def\psforts#1{\let\tst\tslur\def\tslur##1##2{%
523 \ifnum#1=0\tst{##1}{##2}\else%
524 \ifnum#1=1\tfslur{##1}{##2}\else%
525 \ifnum#1<4\tst{##1}{##2}\else%
526 \ifnum#1=4\thslur{##1}{##2}\else%
527 \ifnum#1=5\tHslur{##1}{##2}\else%
528 \tHHslur{##1}{##2}\fi\fi\fi\fi\fi\let\tslur\tst}}%
529 %
530 % Macros to replace slurs with ties
531 %
532 \def\tieforisu{\let\ist\isluru%
533 \def\isluru##1##2{\itieu{##1}{##2}\let\isluru\ist}}%
534 \def\tieforisd{\let\ist\islurd%
535 \def\islurd##1##2{\itied{##1}{##2}\let\islurd\ist}}%
536 \def\tieforts{\let\ist\tslur%
537 \def\tslur##1##2{\ttie{##1}\zcharnote{##2}{~}\let\tslur\ist}}%
538 %
539 % Replacement trill macros, to avoid overfull boxes on 1st pass
540 %
541 \let\savtr\trille\let\savTr\Trille%
542 \def\trille#1#2{\ifeof\inmux\else\savtr{#1}{#2}\fi}%
543 \def\Trille#1#2{\ifeof\inmux\else\savTr{#1}{#2}\fi}%
544 %
545 % Mordent as \rpar. If dotted, must move dot to right.
546 %
547 \def\lpn#1{\loffset{.3}{\lpar{#1}}}% '('
548 \def\rpn#1{\roffset{.3}{\rpar{#1}}}% Beam or not, no dot [ ')' only ]
549 \def\clm#1#2{\mdot{#1}{#2}\cl{#2}}% Non-beam, dot [ '.' + ')' + note ]
550 \def\cum#1#2{\mdot{#1}{#2}\cu{#2}}%
551 \def\qlm#1#2{\mdot{#1}{#2}\ql{#2}}%
552 \def\qum#1#2{\mdot{#1}{#2}\qu{#2}}%
553 \def\hlm#1#2{\mdot{#1}{#2}\hl{#2}}%
554 \def\hum#1#2{\mdot{#1}{#2}\hu{#2}}%
555 \def\qbm#1#2#3{\mdot{#2}{#3}\qb{#1}{#3}}% Beamed & dotted
556 \def\mdot#1#2{\roffset{.32}{\pt{#1}}\roffset{.24}{\rpar{#2}}}%
557 \def\lpnu#1{\smallnotesize\loffset{.3}{\zcharnote{#1}%
558 {\raise1pt\hbox{\musixchar3}}}\normalnotesize}%
559 \def\lpnd#1{\smallnotesize\loffset{.3}{\zcharnote{#1}%
560 {\lower1pt\hbox{\musixchar3}}}\normalnotesize}%
561 \def\rpnu#1{\smallnotesize\roffset{.6}{\zcharnote{#1}%
562 {\raise1pt\hbox{\musixchar4}}}\normalnotesize}%
563 \def\rpnd#1{\smallnotesize\roffset{.6}{\zcharnote{#1}%
564 {\lower1pt\hbox{\musixchar4}}}\normalnotesize}%
565 %
566 % For use with mid-bar signature changes, to permit using \ast machinery
567 %
568 \def\rdoff{\let\toff\off\let\off\addspace}%
569 %
570 % For raising arpeggios by .5/internote
571 %
572 \def\raisearp#1#2{\zcharnote{#1}{%
573 \raise.5\internote\hbox{%
574 \uplap{\leaders\hbox{\musixchar70}\vskip#2\Interligne}}}}
575 %
576 % New Movement Macro
577 %
578 %\def\newmovement#1#2{\let\holdstop\stoppiece\let\holdcont\contpiece%
579 \def\newmovement#1#2#3{\let\holdstop\stoppiece\let\holdcont\contpiece%
580 \ifcase#2\def\endset{\setdoubleBAR}\or\def\endset{\setdoublebar}\or%
581 %\def\endset{\setrightrepeat}\or\def\endset{\empty}\fi%
582 \def\endset{\setrightrepeat}\or\def\endset{\empty}%
583 \or\def\endset{\empty}\fi%
584 \def\stoppiece{\endset%
585 %
586 %+++
587 \ifnum#2=4\zstoppiece\else%
588 %+++
589 %
590 \holdstop%
591 %
592 %+++
593 \fi%
594 %+++
595 %
596 \vskip#1\internote%
597 \let\stoppiece\holdstop}%
598 % \def\contpiece{
599 \def\contpiece{\def\nbinstruments{#3}% <-- assignment inserted here
600 %
601 % Added 120904 per Rainer's suggestion to fix problem with M-Tx at m-break.
602 %
603 \ifx\resetlyrics\undefined\else\resetlyrics\fi%
604 %
605 \startpiece\addspace\afterruleskip\let\contpiece\holdcont}%
606 }%
607 %
608 % Redefinitions for moving dots vertically by x\interligne and
609 % horizontally by y headwidths. Should work for all kinds of dotted notes.
610 % Usage: \def\C@Point#1#2{\PMXpt{.0}{-.2}} (x and y hardwired by PMX)
611 %
612 \global\let\C@Psave\C@Point%
613 \def\PMXpt#1#2#3{\ifodd\n@i\else\raise\internote\fi%
614 \hbox{\raise#1\internote\hbox{\kern#2\qn@width\musixchar#3\kernm#2\qn@width}}%
615 \global\let\C@Point\C@Psave}%
616 %
617 % Shifted, pointed chord notes (Missing in musixtex.tex ???)
618 %
619 \def\lhp#1{\loff{\zhp{#1}}}
620 \def\rhp#1{\roff{\zhp{#1}}}
621 \def\lqp#1{\loff{\zqp{#1}}}
622 \def\rqp#1{\roff{\zqp{#1}}}
623 \def\rhpp#1{\roff{\zhpp{#1}}}
624 \def\lhpp#1{\loff{\zhpp{#1}}}
625 \def\rqpp#1{\roff{\zqpp{#1}}}
626 \def\lqpp#1{\loff{\zqpp{#1}}}
627 %
628 % Redefine to include \sk !!!
629 %
630 \def\liftpause#1{\C@ps\@l@v@n\si@{#1}\sk}
631 %\def\liftPAuse#1{\C@ps{58}0{#1}\sk}
632 % 1/19/03 Replaced old def'n; added \liftPAusep
633 \def\liftPAuse#1{\reflect#1\multiply\reflect2%
634 \zcharnote{0}{\raise\reflect\internote\hbox{\kern.4\qn@width\musixchar58}}\sk}%
635 \def\liftPAusep#1{\reflect#1\multiply\reflect2%
636 \zcharnote{0}{\raise\reflect\internote\hbox{\kern.4\qn@width\musixchar58%
637 \kern-\qn@width\pt4}}\sk}%
638 \def\lifthpause#1{\C@ps\t@n\f@ur{#1}\sk}%
639 \def\liftpausep#1{\reflect#1\advance\reflect2%
640 \wholeshift{\raise\reflect\Interligne\hbox{\pt0}}\liftpause{#1}}%
641 \def\liftpausepp#1{\reflect#1\advance\reflect2%
642 \wholeshift{\raise\reflect\Interligne\hbox{\ppt0}}\liftpause{#1}}%
643 \def\lifthpausep#1{\reflect#1\advance\reflect2%
644 \wholeshift{\raise\reflect\Interligne\hbox{\pt0}}\lifthpause{#1}}%
645 \def\lifthpausepp#1{\reflect#1\advance\reflect2%
646 \wholeshift{\raise\reflect\Interligne\hbox{\ppt0}}\lifthpause{#1}}%
647 %
648 % Text up to bar line. Use before last note, assume 1 noteskip to bar.
649 %
650 \def\bartext#1#2{\sk\loffset{.3}{\zcharnote{#1}{\llap{#2}}}\bsk}
651 %
652 % Macro used before movement break to change # of instruments.
653 % 120818 Set \nbinstruments in \newmovement; probably don't need this any more.
654 %
655 \def\newnoi#1{\let\atnb\atnextbar\def\atnextbar{\atnb\def\nbinstruments{#1}}}%
656 %
657 % Set up top page numbers with optional centered heading
658 %
659 % #2=0 if odds on rt, else 1. #1 = initial page no. #3=name
660 \def\toppageno#1#2#3{\pageno#1%
661 \headline{\reflect#2\advance\reflect\pageno%
662 \ifodd\reflect\rhead{#3}\else\lhead{#3}\fi}%
663 \def\rhead##1{\tempo\ifnum\pageno>1\hfil{##1}\fi\hfil\llap\folio}%
664 \def\lhead##1{\tempo\rlap\folio\hfil{##1}\hfil}}%
665 %
666 % Temporary date and file name. To use it:
667 %
668 % (1) Define a script to create a file tempdate.dat. The file will
669 % contain a single line of text to be centered at the bottom of
670 % each page. I use a 4DOS alias (makedate) that inserts current date
671 % filename, and filedate as follows:
672 %
673 % echo \smalltype\rm Printed %_date from file %1.pmx %@filedate[c:\pmx\%1.pmx],
674 % %@filetime[c:\pmx\%1.pmx] >tempdate.dat
675 %
676 % (2) Include a call to makedate in the batch file you use to run pmx+tex.
677 % Be sure tempdate.dat is written to a directory accessible to TeX.
678 %
679 % (3) Include in-line tex \\tempdate\ at the top of the pmx file.
680 %
681 \def\tempdate{\def\makefootline{\baselineskip2pt\line{\the\footline}}
682 \footline{\hss\input tempdate.dat\hss}}
683 %
684 \def\pnotes#1{\vnotes#1\elemskip}%
685 %
686 % Hairpins and other dynamic stuff
687 %
688 \newdimen\hpi\newdimen\hpii\newdimen\hpiii\newdimen\hpiv%
689 \newdimen\hpv\newdimen\hpvi\newdimen\hpvii\newdimen\hpviii%
690 \newdimen\hpix\newdimen\hpx\newdimen\hpxi\newdimen\hpxii\newdimen\hptmp%
691 %
692 \def\hpstrt#1#2{\getcurpos\advance\y@v#2\qn@width\advance\y@v\txt@ff%
693 \global\csname hp\romannumeral#1\endcsname=\y@v}%
694 %
695 \def\hpendall#1#2#3#4{\getcurpos%
696 \advance\y@v-\csname hp\romannumeral#1\endcsname%
697 \zcharnote{#2}{\kernm\y@v\advance\y@v\txt@ff\advance\y@v#3\qn@width#4{\y@v}}}%
698 %
699 \def\hpcend#1#2#3{\hpendall{#1}{#2}{#3}\crescendo}%
700 \def\hpdend#1#2#3{\hpendall{#1}{#2}{#3}\decrescendo}%
701 %
702 \def\pmxdyn#1#2#3{\ccharnote{#1}{\kern#2\qn@width#3}}
703 \def\txtdyn#1#2#3{\zcharnote{#1}{\kern#2\qn@width#3}}
704 %
705 \def\sfz{{\ppff s\f@kern\f@kern f\f@kern z}}%
706 %
707 % Dotted breve and rest
708 %
709 \def\brevep{\def\w@h{\musixchar32\roffset\qu@rt{\C@Point\z@\raise}}%
710 \y@v\wn@width \g@w}
711 \def\PAusep{\loffset{.5}{\pt5}\PAuse}%
712 %
713 % Vertical equalization macros
714 %
715 %\newskip\pssav\pssav\parskip%
716 %
717 % Remove this from here in 2.352, since it caused some incompatibilities.
718 % (Let PMX write it into *.tex when needed).
719 %
720 %\parskip 0pt plus 12\Interligne minus 99\Interligne%
721 \def\upamt{27}\def\dnamt{-20}%
722 %\def\upstrut{\znotes\nextinstrument\nextinstrument\zcharnote{\upamt}{X}\en}%
723 %
724 % Let PMX write the def'n of \upstrut since I couldn't get the loop to work
725 %
726 \def\dnstrut{\znotes\zcharnote{\dnamt}{~}\en}%
727 %
728 % Call the following inline type1 anywhere in first line of equalization.
729 %
730 \def\starteq{\gdef\everystaff{\upstrut\dnstrut}\dnstrut}%
731 %
732 % And put this as type 1 in the next-to-last line of equalization!
733 %
734 %\def\endeq{\gdef\everystaff{\upstrut\global\parskip\pssav%
735 \def\endeq{\gdef\everystaff{\upstrut%
736 \gdef\everystaff{\empty}}}%
737 %
738 \gdef\spread#1{\global\let\cont\contpiece%
739 \gdef\contpiece{\vskip#1\internote\cont\global\let\contpiece\cont}}%
740 %
741 % The following avoid zapping \writezbarno in several special situations
742 %
743 \def\PMXbarnotrue{\let\z@sw\empty}%
744 \def\PMXbarnofalse{\let\z@sw\@ne}%
745 %
746 % Centered rests
747 %
748 \def\pausc{\lrlap{\pause\off{\qn@width}}}%
749 \def\PAusc{\lrlap{\PAuse\off{\txt@ff}}}%
750 %\def\liftpausc#1{\raise#1\Interligne\pausc}%
751 \def\liftpausc#1{\raise#1\Interligne\lrlap{\
752 \raise6\internote\hbox{\musixchar11}\off{1.2\qn@width}}}%
753 \def\liftPAusc#1{\raise#1\Interligne\PAusc}%
754 %
755 % CenterBar and mbrest modified 2/01 to account for simick mods in
756 % musixtex 1.01
757 %
758 \def\CenterBar#1#2#3{%
759 \y@ii\lin@pos\advance\y@ii-\lastbarpos%
760 \ifx\volta@startcor\undefined \else\advance\y@ii\cut@v\fi%
761 \advance\y@ii-#2pt\advance\y@ii-#3pt\kern-#3pt%
762 \kern-\h@lf\y@ii\lrlap{#1}\kern\h@lf\y@ii\kern#3pt}%
763 %
764 % mbrest mods 151226. Changed # of args in mbrest from 3 to 1;
765 % changed pmx271 accordingly
766 % 160103 back to 3 args
767 %
768 \def\mbgap{\qsk\hqsk}%
769 \def\mbrhgt{9}%
770 \def\mbrest#1#2#3{%
771 %\CenterBar{\ccn{9}{\meterfont#1}}{#2}{#3}%
772 \CenterBar{\ccn{\mbrhgt}{\meterfont#1}}{#2}{#3}%
773 \CenterBar{%
774 \ifcase #1%
775 \relax%
776 \or\cpause% 1
777 \or\cPAuse% 2
778 \or\cPAuse\mbgap\cpause% 3
779 \or\cPAUSe% 4
780 \or\cPAUSe\mbgap\cpause% 5
781 \or\cPAUSe\mbgap\cPAuse% 6
782 \or\cPAUSe\mbgap\cPAuse\mbgap\cpause% 7
783 \or\cPAUSe\mbgap\cPAUSe% 8
784 \or\cPAUSe\mbgap\cPAUSe\mbgap\cpause% 9
785 \else
786 \def\vertpart{\hbox{\vrule width.6pt height1.5\internote depth1.5\internote}}%
787 \raise4\internote\hbox{\vertpart%
788 \vrule width0.7\y@ii height.5\internote depth.5\internote%
789 \vertpart}%
790 \fi}{#2}{#3}}%
791 %
792 % 151226 Redefine \xchangecontext to add in \afterruleskip
793 %
794 \def\xchangecontext{\n@wbar\writ@newclefs
795 \wbarno@x\Writ@newsigns\Writ@meters\lastbarpos\lin@pos\addspace\afterruleskip}%
796 %
797 % 151227 Define \ccoda so it positions like any other ornament
798 %
799 \def\ccoda{\n@iv85\@Char}%
800 \def\pcaesura#1#2{\raise#1\internote\hbox{%
801 \rlap{\kern.5\noteskip\kern#2\qn@width\musixchar79}}}%
802 \def\pbreath#1#2{\zcharnote6{\raise#1\internote\hbox{%
803 \rlap{\kern.5\noteskip\kern#2\qn@width\BIGfont'}}}}%
804 %
805 % Macro to set up for blank bar line
806 %
807 %\def\setzalaligne{\let\alat\alaligne%
808 % \def\alaligne{\zalaligne\let\alaligne\alat}}%
809 \def\setzalaligne{\let\zalat\stoppiece%
810 \def\stoppiece{\zstoppiece\let\stoppiece\zalat}}%
811 %
812 % Slanted line arpeggio or coule ornament
813 %
814 \def\arpg#1#2{%
815 \roffset{#2}{\zcharnote0{\raise#1\internote\hbox{\varline0{6pt}{20}}}}}%
816 \def\arpgu#1{\arpg{#1}{.8}}%
817 %
818 % \pmxlyr command, see Usage afer \endinput. Dirk Laurie 2016-01-24
819 % The unrolled loops are necessary because \assignlyricshere must have
820 % a raw string literal as argument.
821 \def\pmxlyr#1{%
822 \ifnum\noinstrum@nt=1%
823 \ifnum\noport@@=1%
824 \if@pmx@nextvoice\setlyrics{I1P1V2}{#1}\assignlyricshere{I1P1V2}%
825 \else\setlyrics{I1P1V1}{#1}\assignlyricshere{I1P1V1}\fi\fi%
826 \ifnum\noport@@=2%
827 \if@pmx@nextvoice\setlyrics{I1P2V2}{#1}\assignlyricshere{I1P2V2}%
828 \else\setlyrics{I1P2V1}{#1}\assignlyricshere{I1P2V1}\fi\fi\fi%
829 \ifnum\noinstrum@nt=2%
830 \ifnum\noport@@=1%
831 \if@pmx@nextvoice\setlyrics{I2P1V2}{#1}\assignlyricshere{I2P1V2}%
832 \else\setlyrics{I2P1V1}{#1}\assignlyricshere{I2P1V1}\fi\fi%
833 \ifnum\noport@@=2%
834 \if@pmx@nextvoice\setlyrics{I2P2V2}{#1}\assignlyricshere{I2P2V2}%
835 \else\setlyrics{I2P2V1}{#1}\assignlyricshere{I2P2V1}\fi\fi\fi%
836 \ifnum\noinstrum@nt=3%
837 \ifnum\noport@@=1%
838 \if@pmx@nextvoice\setlyrics{I3P1V2}{#1}\assignlyricshere{I3P1V2}%
839 \else\setlyrics{I3P1V1}{#1}\assignlyricshere{I3P1V1}\fi\fi%
840 \ifnum\noport@@=2%
841 \if@pmx@nextvoice\setlyrics{I3P2V2}{#1}\assignlyricshere{I3P2V2}%
842 \else\setlyrics{I3P2V1}{#1}\assignlyricshere{I3P2V1}\fi\fi\fi%
843 \ifnum\noinstrum@nt=4%
844 \ifnum\noport@@=1%
845 \if@pmx@nextvoice\setlyrics{I4P1V2}{#1}\assignlyricshere{I4P1V2}%
846 \else\setlyrics{I4P1V1}{#1}\assignlyricshere{I4P1V1}\fi\fi%
847 \ifnum\noport@@=2%
848 \if@pmx@nextvoice\setlyrics{I4P2V2}{#1}\assignlyricshere{I4P2V2}%
849 \else\setlyrics{I4P2V1}{#1}\assignlyricshere{I4P2V1}\fi\fi\fi%
850 }%
851 %
852 % Definition for \lyrlink&\at, used with pmxlyr strings with '~'and '@'
853 %
854 \def\lk{\lyrlink}%
855 \def\at#1{\lyrraisehere{#1\internote}}%
856 %
857 % 190526 Items for short line enhancements
858 %
859 \let\wbnt\writebarno
860 \def\nobarno{\gdef\writebarno{\global\let\writebarno\wbnt}}
861 %
862 % 200123 Open headed dotted chord notes
863 %
864 \def\hbp{\h@symbol\@qbp}%
865 \def\hbpp{\h@symbol\@qbpp}%
866 %
867 \catcode`\@=\catcodeat
868 \endinput
869
870 Usage:
871 \pmxlyr{TEXT} (assigns TEXT as lyrics in the current context)
872
873 In PMX, enter the command with a trailing backslash. Starting at PMX 2.73,
874 "TEXT" on a music line is equivalent to \pmxlyr{TEXT}.
875
876 Spaces and hyphens separate TEXT into syllables. An underscore between
877 words combines syllables from different words into a single syllable.
878
879 TEXT may contain any TeX macro, in particular:
880 \space Space character that does not separate syllables
881 \lyrhyphenchar Hyphen that does not separate syllables
882 {\empty} Invisible syllable (for notes that get no lyrics)
883
884 \pmxlyr uses the unexpanded contents of TEXT when looking for the
885 syllable splitters, e.g. \def\mylyrics{many words of poetry} followed
886 by \pmxlyr{\mylyrics} will put all those words on one note.
887
888 For more information on what is acceptable in TEXT, consult mxlyrdoc.pdf.
889
890 Limits: Lyrics are recognized only on the first two staves of instruments
891 1 to 4. Elsewhere they are ignored.
892