Hello Don!

Am 16.08.2012 schrieb Don Simons:
> Anyhow, I was afraid it might be in musixlyr, because it's long and
> complicated. Rainer, it would be great if you'd jump in here :-)

Okay, let's go! I'm not sure about this particular case, but I do know 
that we already discussed a few problems all of which had the same 
cause: that musixlyr is more fussy about the correct order of changes of 
the instrument number (and other vertical properties) than PMX. 
Specifically, PMX uses its own macro \newnoi to initiate an instrument 
number change. That macro, in turn, wraps that change into an \atnextbar 
command. That works for PMX itself, but it causes trouble for musixlyr 
because \atnextbar is executed already before the pending system is 
actually closed by MusiXTeX's \stoppiece macro. But musixlyr injects 
some system closing activities into \stoppiece (specifically, handling
of pending hyphens), and for that, it must rely on the instrument number 
still being the one of the pending system---but the number is already 
changed to the new one by \atnextbar! In the given problem example, at 
the end of the second-last system (bar number 3) with two instruments, 
musixlyr believes that five instruments (= the new instrument number) 
are to be processed and therefore it messes up the vertical spacing.

So, what to do? I'm afraid the problem can't be solved in musixlyr.tex 
but rather in pmx.tex. The goal is to make the instrument number change 
happen at the line break rather than at the bar line (which is the same 
only seemingly). The \newnoi macro ...

\def\newnoi#1{\let\atnb\atnextbar\def\atnextbar{\atnb\def\nbinstruments{#1}}}%

... should thus be changed to:

\def\newnoi#1{\let\atnl\atnextline\def\atnextline{\atnl\def\nbinstruments{#1}}}%

(Well, at least this would solve the problem in question, but could it 
cause unwanted side effects? I don't know ...)

But that's not sufficient, since pmx.tex deactivates \atnextline at 
movement breaks by redefining MusiXTeX's \contpiece macro (where 
\atnextline is normally executed). To complete the solution, the 
\atnextline call should be re-inserted into this \contpiece 
redefinition; this happens within the PMX macro \newmovement:

\def\newmovement#1#2{...
 \def\contpiece{\atnextline \let\atnextline\empty
                ...}%
}%

I've put all this together to a working example that solves the problem 
(at least for me, using M-Tx 0.60d (Music from TeXt) <<11 October 
2008>>, MusiXTeX(c) 1.15 <3 April 2011>, and PMX Version 2.614a <17 July 
11>); I'll append it to this e-mail (beware of unwanted line breaks).

As mentioned before, I can't tell whether this solution would work in 
every case and without causing further trouble; therefore it's rather a 
proposal than a ready-made fix.

Best regards,

Rainer


8<--------(80 characters wide)--------------------------------------------------
---
\def\mtxversion{0.60d}
\def\mtxdate{<11 October 2008>}
\input mtx

% these two force pmx.tex to be loaded prior to the following redefinitions
% of \newnoi and \newmovement
\input musixtex
\input pmx

% \newnoi using \atnextline instead of \atnextbar
\def\newnoi#1{\let\atnl\atnextline\def\atnextline{\atnl\def\nbinstruments{#1}}}%

%
% New Movement Macro
%
\def\newmovement#1#2{\let\holdstop\stoppiece\let\holdcont\contpiece%
\ifcase#2\def\endset{\setdoubleBAR}\or\def\endset{\setdoublebar}\or%
%\def\endset{\setrightrepeat}\or\def\endset{\empty}\fi%
\def\endset{\setrightrepeat}\or\def\endset{\empty}%
 \or\def\endset{\empty}\fi%
 \def\stoppiece{\endset%
%
%+++
\ifnum#2=4\zstoppiece\else%
%+++
%
\holdstop%
%
%+++
\fi%
%+++
%
\vskip#1\internote%
\let\stoppiece\holdstop}%
 \def\contpiece{% The following line is the only change to the original
                % \newmovement: Execute \atnextline before \startpiece---
                % that's the place where the instrument number change
                % actually happens, and that's appropriate for musixlyr:
                % _after_ the pending system has been closed by \stoppiece
                \atnextline \let\atnextline\empty
                \startpiece\addspace\afterruleskip\let\contpiece\holdcont}%
}%
---
5 5 4 4 4 4 0 0
2 5 20 0





ttttt
.\
AI.7

g04 /
g04 /
g04 /
g04 /
g04 /

L2P2Mn212tt
g04 /
g04 /
g04 /
g04 /
g04 /
g04 /

L5Mn512345ttttt
g04 /
g04 /
g04 /
g04 /
g04 /
8<--------(80 characters wide)--------------------------------------------------
-------------------------------
TeX-music@tug.org mailing list
If you want to unsubscribe or look at the archives, go to 
http://tug.org/mailman/listinfo/tex-music

Reply via email to