Hello Don and Hermann!

Am 04.02.2011 schrieb [email protected]:
> Hermann Hinsch posted a problem with an M-Tx-originated PMX source. 
> I've discovered that the following simpler code duplicates the 
> problem. Just comment out "\input musixlyr" and the vertical spacing 
> between first 2 systems on p. 2 becomes much better, even though NONE 
> of the macros defined in musixlyr.tex is used. Can anyone (Rainer 
> Dunker where are you?) figure out what's going on??? And if so, maybe 
> devise inline tex to cancel the effect?

I'm still here, but am quite silent for a longer time now because I'm no 
longer actively using MusiXTeX and friends myself.

The problem in question here is really interesting. From my point of 
view, it is due to a bad synchronization of the instrument number change 
with the line break. I'll try to explain:

At each line ending, musixlyr has to perform some actions that must 
occur _after_ all notes of the line have been set; specifically, it has 
to typeset underscores and hyphen sequences at melismas that continue in 
the next line. To make these actions take place at the very end of the 
current line's processing, their function call is injected in MusiXTeX's 
\stoppiece macro (somehow ...).

Now, PMX obviously does instrument number changes by means of its 
\newnoi macro, which in turn wraps the number change in \atnextbar. But 
that's too early for musixlyr to function properly: \atnextbar is 
executed prior to \stoppiece - that is, when musixlyr starts its 
line-ending processing, the instrument number is already changed! That 
makes musixlyr believe that the current system has 5, not 2 instruments, 
thus it does some invisible typesetting (don't remember what exactly) 
for 5 instruments instead of 2, and the 2-instrument system takes as 
much vertical space as a 5-instrument system - and that's the reason for 
the effect we're seeing here.

So, how to solve this? From musixlyr's point of view, the most proper
way would be to make the instrument number change happen only _after_
the current system is really finished. My suggestion is: Let \newnoi
wrap the \def\nbinstruments call in \atnextline instead of \atnextbar -
as I understand, that's the proper place for such a system-affecting
change anyway.

But then there's still another issue: PMX's \newmovement macro - which 
is calles subsequently at the system break in question - replaces 
\contpiece by \startpiece to initiate the next system, but \startpiece 
does _not_ call \atnextline implicitly. To solve this, I suggest to 
insert an explicit \atnextline call into \newmovement, right before it 
calls \startpiece.

A test with your example shows that these two changes solve the current 
problem, but of course I don't know whether they would cause any 
unwanted side effects. Therefore I must leave it up to you to judge 
whether my suggestions are a real solution.

For your reference, I've put the described changes in a .mod file that
you can use along with your original example. I attach it here as a MIME
attachment to protect it from false line breaking.

Best regards,

Rainer
%
% \newnoi changes the number of instruments. To make musixlyr's line-ending
% actions work properly, this should be done using \atnextline instead of
% \atnextbar.
%
\def\newnoi#1{\let\atnl\atnextline\def\atnextline{\atnl\def\nbinstruments{#1}}}

%
% This is taken literally from pmx.tex and changed only by the insertion
% marked below.
%
\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{%
   %
   % INSERTION: Contrary to \contpiece, \startpiece does not execute
   % \atnextline; since \contpiece is replaced by \startpiece here,
   % \atnextline has to be called explicitly to execute the
   % instrument number change.
   % The \atnextline call and reset ist taken literally from musixtex.tex's
   % \piece@conta macro.
   %
   \atnextline \let\atnextline\empty
   %
   % END OF INSERTION
   %
   \startpiece\addspace\afterruleskip\let\contpiece\holdcont}%
}%


%
% Some lyrics stuff to prove whether musixlyr works properly across
% the instrument number changes. It sets no reasonable lyrics but
% challenges musixlyr's line-ending actions by filling the whole piece
% with an long sequence of hyphens.
%
\setlyrics1{a__________________-b}
\setlyrics2{a__________-b}
\assignlyrics11
\assignlyrics52
\lyrraise1{b-1.5em}
-------------------------------
[email protected] 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