2016-01-17 11:15 GMT+02:00 David Allsopp <[email protected]>:
> Dirk Laurie wrote:
>> After the latest changes to M-Tx on GitHub, I was tempted to remove
>> "\input pmx" from mtx.tex since it is no longer needed there and will be
>> input from the .tex files made by PMX.
>>
>> Doing so gives an error "No room for a new \read" on the big mtxdoc.ltx
>> build. Apparently one is not allowed more than 12 file handles. This
>> should of course be fine.
>>
>> But for some reason, pmx.tex is reloaded every time. I'm using a modified
>> pmx.tex (attached) that tests on \pmxversion and writes entry/exit
>> messages. The original mtx.tex with "\input pmx"
>> duly gives "Already loaded PMX 2.72" as expected.
>>
>> I can solve my problem, easily: just don't remove "\input pmx".
>> But I can't understand why it happens.
>>
>> The complete logs of the whole musixtex.tex pass are also attached, but
>> let me reduce it to simple terms in terms of how every small TeX file made
>> by PMX starts.
>>
>> Case 1:
>>
>> \input mtx % Does not contain "\input pmx"
>> \input musixtex
>> \input pmx % Reloads it every time.
>>
>> Case 2:
>>
>> \input mtx % Contains "\input pmx".
>> \input musixtex
>> \input pmx % Sees \pmxversion and does not reload it.
>>
>> As you can see, mtx.tex starts with exactly the same kind of test that
>> pmx.tex does. Since \mtxversion is seen the next time that \input mtx
>> comes along, its "input pmx" happens once only. I.e. I can understand why
>> keeping it in works.
>>
>> But I can't understand why \pmxversion is not also seen.
>
> When running your version without \input pmx (Case 1),
> try altering pmx.tex to have \gdef\pmxversion{2.72} instead of \def
> - what happens then?

Yes, that was in fact the first thing I tried. It works in the sense
that pmx.tex is not loaded again, but then no other PMX macro
is defined.

I have been making many experiments in the meanwhile
and think I now know what happens.

The main LaTeX file starts off
   \usepackage{color,mtxlatex,mtxdoc,multicol}

mtxlatex.sty contains "\input mtx" but not "\input pmx".
There is the difference.

And the reason why the first "\input pmx" does not persist
is that every PMX-generated example is input inside
\begin{mus}...\end{mus}.

So the clean solution is to take "\input pmx" out of mtx.tex
(which does not need it) and put it inside the \mtxlatex
command in mtxlatex.sty, which by implication needs it
since it defines environments like "mus" that are only used
for including PMX-generated TeX files.
-------------------------------
[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