[metapost] A problems with \mpxshipout

Dan Luecking luecking at uark.edu
Sun Aug 28 00:44:25 CEST 2005


Metaposters:

The current(?) version of metapost (0.901) exhibit a problem with
the .tex file create by mpto -tex for btex handling. The old
hardcoded wrapper around TeX code was replaced by a macro that
behaved incorrectly (or rather was incompatible with dvitomp) in
some cases. Also the definition of that macro occurs first in the
.tex file preventing the %&latex convention from working in some
systems. Finally, it reads the TeX code as an argument, preventing
\verb (or anything relying on catcode changes) from working.

I submitted a bug report and received the reply below. I would like
to follow up this reply, but couldn't figure out how to do so through
the bug-tracker on sarovar (unless I reported a new bug, which this
really isn't). So I decided to send my comments to this list.

Below is the reply:

 > Thanks. I've just commited a new version of mpto.c (CVS)
 > that hopefully fixes all of your comments. It now outputs
 > two separate definitions just before the first btex ... etex:
 > (but after the verbatimtex ... etex )

My comments relate to this timing of the output. The new definitions
are quoted below and seem to work fine. This timing is also fine
*if* there is only one verbatimtex ... etex in the file. However,
the package mfpic (that I maintain) creates .mp files that contain
several verbatintex ... etex commands designed to create local groups.
Something like the following occurs:
   verbatimtex \begingroup
     <font change or local definitions>
   etex;

   <... metapost commands, including btex ... etex>

   verbatim \endgroup etex;
   <...possibly many repetitions of the above pattern>

If the definitions are output just before the first btex.
they will end up inside this first group and be lost to the
rest of the file. This potentially breaks any file created
by mfpic over the past couple of years.

This can be resolved in any of several ways. I would prefer one of
these two:
1) Keep the timing as is, but make the definitions global. They
    probably should be global anyway,  even if (2) is chosen.
2) Output them just before the _second_ verbatimtex or the first btex,
    whichever comes first.

I can write a work-around definition of \mpxshipout into the first 
verbatimtex, which will override the incorrect one with the timing
of 0.901 but which will be overridden by the new one with either of
these timings, thus permitting such files to work in all versions
of MP.

 > \def\mpxshipout{\shipout\hbox\bgroup%
 >   \setbox0=\hbox\bgroup}%
 > \def\stopmpxshipout{\egroup  \dimen0=\ht0 \advance\dimen0\dp0
 >   \dimen1=\ht0 \dimen2=\dp0
 >   \setbox0=\hbox\bgroup
 >     \box0
 >     \ifnum\dimen0>0 \vrule width1sp height\dimen1 depth\dimen2
 >     \else \vrule width1sp height1sp depth0sp\relax
 >     \fi\egroup
 >   \ht0=0pt \dp0=0pt \box0 \egroup}
 >
 > \mpxshipout% line 4 test.mp
 > n\stopmpxshipout

(The last two lines are sample .tex output by mpto -tex in the
developement version.)


Dan


Daniel H. Luecking
Department of Mathematical Sciences
University of Arkansas
"Be kind. Every person you meet is fighting a hard battle." - Anon.



More information about the metapost mailing list