[metapost] a problem of label when using metapost

Reinhard Kotucha reinhard.kotucha at web.de
Thu Nov 17 23:01:49 CET 2011


On 2011-11-17 at 07:38:40 -0500, source liu wrote:

 > no, mpost --version gives 1.208. thanks, it seems only pass the
 > -tex=latex works, regardless
 > of
 > %&latex is written or not, at the very position.
 > 
 > but if it appears before verbatimtex, it would be warned
 > "/some/path/of/my/tex/latex.fmt" is not a
 > mem file

Yes, everything within the verbatimtex environment is passed to the
preamble of the TeX file, everything else is processed by Metapost.

You want to tell the TeX engine which format file it should load,
hence %&latex has to be at the top of the TeX file and must therefore
be stated within the verbatimtex environment.  If it appears outside
of the environment, Metapost certainly will search for latex.mem (not
latex.fmt).

Nicola wrote:

 >> verbatimtex%&latex
 >>
 >> without any space between verbatimtex and %&. 

If this solves anything then something is wrong with Metapost.

 >> Note that this is exclusive or: if you pass '-tex latex' on the
 >> command line, remove %&latex from the source file.

I would expect that command-line arguments override %&-statements.
They are also more reliable.  The behavior of %&latex depends on a few
other things which changed in the past.  Whether it works depends on
which program is called by default.  At the beginning everything was
easy.  There was a program called tex and the LaTeX macro package was
running on top of it.  Later, LaTeX was set up to run under pdftex,
which is another program.

The problem then was that once the program tex was invoked and found
the line

  %&latex

it tried to load the file latex.fmt.  This was supposed to fail
because latex.fmt could only be used with pdftex, not with tex.  

With other words, %&-statements allow you to change the format file
but not the program it depends on.  I suppose that Metapost's default
TeX system is etex now, which is based on pdftex too.  Then it should
work again.

But it's not a long-term solution either.  Just try:

  %&lualatex

If you specify the format on the command-line, you always get the
proper format file AND the engine it depends on.

The %&-syntax came up at a time when everybody believed that TeX is
frozen forever...

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------


More information about the metapost mailing list