Hi Bob!
Am 27.01.2015 schrieb Bob Tennent:
> Hi all. I'm finding that musixtnt.tex (which provides a
> user-friendly macro \TransformNotes that re-defines \vnotes)
> is incompatible with musixlyr.tex.
> [...]
> I don't have sufficient TeXpertise to follow what
> musixlyr.tex does (and the comments are in German, which I
> don't read). I've sent a message to Rainer Dunker but have
> had no reply.
Sorry for both the German comments and for not having replied yet. Only
yesterday I had time to have a closer look at the problem.
In the TransformNotes manual, you say: "It is essential that every
\znotes, \notes, \Notes, \NOtes, etc. command in the score match the
pattern of the first argument to \TransformNotes exactly". That's what
leads to the incompatibility with musixlyr.tex. See this minimized
example:
\input musixtex \input musixtnt
\instrumentnumber2
\startpiece
\TransformNotes{#2}{#3}%
\NOtes\qa g&\qa h\en
\endpiece\end
Everything's fine here. But what about using macros for your notes
material:
\input musixtex \input musixtnt
\instrumentnumber2
\startpiece
\TransformNotes{#2}{#3}%
\def\theNotes{\qa g&\qa h}%
\NOtes\theNotes\en
\endpiece\end
That no longer works because your redefinition of \vnotes in musixtnt.tex ...
\def\vnotes##1\elemskip#1\en{\noteskip##1\@l@mskip\@vnotes#2\en}
... expects to find the '&'s literally within the \NOtes...\en sequence.
The same happens if musixlyr is engaged. At the end of each staff
system, musixlyr has to take care of pending hyphenations and word
continuation underlines in case a multi-syllable word or a melisma spans
across the system break, as in this example:
\input musixtex \input musixlyr
\setlyrics{S}{Mu-sic} \assignlyrics1{S}
\startpiece\addspace\afterruleskip
\NOtes\qa g\en
\alaligne
\NOtes\qa g\en
\endpiece\end
musixlyr does so by silently adding a "\znotes<do hyphens and underlines>\en"
sequence right before MusiXTeX really finishes the system. The <do
hyphens and underlines> loops over all existing instruments and staves;
the involved '&'s are therefore buried deeply inside stacked macros (see
\def\sysend@lyrics and the related definitions in musixlyr.tex).
The \TransformNotes-altered \vnotes would thus never see any '&' in its
argument stream and therefore quits with a runaway argument error.
(Precisely, musixlyr's \sysend@lyrics@instrum@loop macro doesn't even
use '&' but its alias \nextinstrument instead. This could be changed but
wouldn't help to solve the problem.)
This really seems to be a dilemma. \TransformNotes can't simply ignore
musixlyr's system ending activites, otherwise continued hyphens and
underlines would appear at the wrong place or not at all. And musixlyr
must use macros inside its \znotes...\en because it has to loop
dynamically over the present instruments and staves.
I experimented a bit with a redefinition of \znotes involving
\expandafter or \edef, hoping to help the '&'s reach the surface of the
token stream that \vnotes gets as its argument--like this ...
\gdef\TransformNotes#1#2{%
\def\vnotes##1\elemskip#1\en{\noteskip##1\@l@mskip\@vnotes#2\en}%
\def\znotes{\expandafter\vnotes\expandafter0\expandafter\elemskip}%
}
... but without success: \expandafter does just a single level of macro
expansion which is insufficient to unwrap the '&'s that musixlyr's
\sysend@lyrics generates, and \edef gobbles them up long before \vnotes
would see them in its argument.
I've no more ideas how to solve this incompatibility. But maybe this
information is helpful for you somehow.
Oh, wait ... another thought just comes up: You could perhaps rescue the
matter by replacing musixlyr's definition of the dynamic system-ending
loop by a static one that's adapted to the current instrument
configuration. This is the decisive definition in musixlyr.tex:
\def\z@suspend{%
\znotes\sysend@lyrics\empty\en
\znotes\sysend@lyrics\auxlyr\en
\@orig@z@suspend}
(Here you can see the problematic \sysend@lyrics macro calls within
\znotes.) You could replace it by something like this (in this
example, for 2 single-staff instruments):
\def\z@suspend{%
\znotes\sysend@lyrics@for@one@instrum &%
\sysend@lyrics@for@one@instrum \en
\@orig@z@suspend}
This is, of course, not yet ready-to-use and would have to be further
developed. But it _should_ help because the necessary '&'s occur
literally in \znotes...\en. The major drawback would be, of course, that
the user would have to make this definition in his score source file.
That is ... unless we could find a smart way to assemble that macro
definition programmatically within \TransformNotes, but that seems to be
a real challenge (involving many \expandafters and \noexpands). Do you
think that's the way to go?
Best regards,
Rainer
-------------------------------
[email protected] mailing list
If you want to unsubscribe or look at the archives, go to
http://tug.org/mailman/listinfo/tex-music