[metapost] Limits for TEX.mp?
Brian Kell
bkell at cmu.edu
Fri May 6 00:20:03 CEST 2011
I am working on a couple of MetaPost drawings that have a lot of nearly
identical labels, differing only in subscripts, so I'm generating them
with the TEX() macro from TEX.mp inside a pair of nested loops. These
are all very simple labels---they're all of the following form:
TEX("$c_{" & decimal(i) & decimal(j) & "}$")
Partway through my second drawing, I get the error "Unable to make mpx
file" from MetaPost, on a loop iteration that is just like all the other
iterations. The full error is shown below.
fatal: Command failed: etex --parse-first-line --interaction=nonstopmode
mp632926.tex; see mpxerr.log
>> mptextmp.mp
>> mptextmp.mpx
! Unable to make mpx file.
l.1 btex
$c_{31}$ etex
1 output file written: final-3a.mps
Transcript written on final.log.
It seems that MetaPost is running into a limit on the number of times
the TEX() macro can be called. For this particular file, the limit
appears to be 122 times (the error occurs on the 123rd call).
I was able to isolate the problem to a simpler input file:
input TEX;
beginfig(1);
for i=1 upto 300: label(TEX(decimal(i)), (0,0)); endfor
endfig;
When I feed this to MetaPost, everything goes smoothly for the first 243
iterations, but I get the "Unable to make mpx file" error on the 244th
iteration. I can make the label text a little more complex to more
closely mirror my original file:
input TEX;
beginfig(1);
for i=1 upto 300:
label(TEX("$x_{" & decimal(i) & "}$"), (0,0));
endfor
endfig;
In this case I get 122 successful iterations, but the "Unable to make
mpx file" error occurs on the 123rd iteration, which is exactly where I
see the problem in my original file.
I can work around this issue for the moment by separating my two
drawings into two different MetaPost files, because individually the
drawings use fewer than 123 TEX() calls each. However, I can foresee
that someday I might want to make a drawing with more labels than that;
is there something I can do to fix this problem, or at least raise the
limit?
I'm using MetaPost version 1.208 (kpathsea version 5.0.0).
Brian Kell
More information about the metapost
mailing list