[texhax] re-defining \vnotes in musixtex

Bob Tennent rdt at cs.queensu.ca
Wed Jan 7 17:43:24 CET 2015


 >|It is possible to re-define the basic \vnotes macro in
 >|musixtex to achieve various effects.
 >|
 >|For example,
 >|
 >| \def\vnotes#1\elemskip#2&#3\en
 >|   {\noteskip#1\@l at mskip\@vnotes#3\enotes}
 >|
 >|produces a single-instrument part from a two-instrument score,
 >|
 >| \def\vnotes#1\elemskip#2&#3\en
 >|   {\noteskip#1\@l at mskip\@vnotes#2&\transpose+7#3\enotes}
 >|
 >|transposes the second instrument an octave higher, and
 >|
 >| \def\vnotes#1\elemskip#2&#3\en
 >|   {\noteskip#1\@l at mskip\@vnotes#3&#2\enotes}
 >|
 >|will switch the order of the two instruments.  These all
 >|have to be used within \makeatletter ... \makeatother
 >|brackets.
 >|
 >|I'd like to provide a user-friendly "front end" so that
 >|users could write
 >|
 >|  \transinstr{#2&#3}{#3}
 >|
 >|  \transinstr{#2&#3}{#2&\transpose+7#3}
 >|
 >|  \transinstr{#2&#3}{#3&#2}
 >|
 >|or, even better,
 >|
 >|  \transinstr{#1&#2}{#2}
 >|
 >|  \transinstr{#1&#2}{#1&\transpose+7#2}
 >|
 >|  \transinstr{#1&#2}{#2&#1}
 >|
 >|and not have to deal with the \makeat... brackets, the
 >|\elemskip argument and \@l at mskip\@vnotes.
 >|
 >|Would this be feasible in TeX?

I've made some progress on this.

\gdef\transinstr#1#2{\def\vnotes##1\elemskip#1\en{\noteskip##1\@l at mskip\@vnotes#2\enotes}}

almost works; but the \@... commands are not recognized.

If I do

\makeatletter
\let\myelemskip\@l at mskip
\let\myvnotes\@vnotes
\makeatother

and use \my... instead of \@..., it works. Is there a better
way? Using \makeat... brackets inside the macro text doesn't
seem to work.

Bob T.



More information about the texhax mailing list