[metapost] nonstopmode interaction

Dan Luecking luecking at uark.edu
Thu Oct 13 20:44:12 CEST 2011


At 11:17 AM 10/13/2011, Troy Henderson wrote:
>$TEX being just an environment variable, it could point a 
>user-supplied script that runs whatever TeX engine you want, plugs 
>in a default DVI if the actual tex chokes for some reasonb, and 
>always returns succesfully.
>
>Is the DVI deleted after MP runs?  I cannot find this DVI, and as a 
>consequence, I cannot determine its structure.  How are the labels 
>laid out in the DVI?  One per page?  One immediately "after" 
>(whatever that means) another?

Each individual label is in a separate page, wrapped in hboxes,
and tagged with a \vrule with width 1sp, in the order they appear
in the .mp file (exception: see below). In the old days you would
debug by running mptotex separately, examine the .tex file and see
the tex commands that set the label. Then perhaps, run tex and
dvitomp before running mpost again.

Now (mpost version 1.504 in my case) you can do almost the same
thing like so:
   mpost --debug file.mp
This leaves the .tex file in mperr.tex and the temporary .dvi
file in mpaNNNNN.dvi (where NNNNN is some random digit string).
If you then run
    mpost --dvitomp mpa01324.dvi file.mpx
and then
    mpost file.mp
again, you get what you want.

But a mostly fatal problem comes up in your case. TeX does
not recover very gracefully from your error. The error is
   "missing $ or extra }".
If tex were to simply insert the missing "$" before the "}",
all could proceed reasonably well, instead it discards the "}"
(and at least one more) and continues to read the third label
while trying to finish the second one. As a consequence, the
third label is shipped out *before* the second is finished.
One gets the third label in the second place and the second
label (ultimately an empty box) in the third place. (In
interactive mode you could remedy this by typing "i$}" at
the error prompt.)

It is a possibility like this that convinces me it is correct
to make a tex error a fatal one. Some very simple tex errors
could have the same effect: unfinished conditionals and missing
macro arguments come to mind.

Suggestion: problems with creating the mpx file are very
common. The documentation on debugging (section 14.3 of
mpman.pdf) could mention this and refer to the -debug option
in Appendix A.2.1.


Dan


Daniel H. Luecking
Department of Mathematical Sciences
Fayetteville, Arkansas
http://www-cs-faculty.stanford.edu/~knuth/iaq.html 



More information about the metapost mailing list