# [metapost] mptopdf corrupts source file - Engines.tar.bz2 (1/1)

Oliver Buerschaper oliver.buerschaper at mpq.mpg.de
Sun Jan 17 18:04:59 CET 2010

Hi Nicola,

> Let me clarify a bit. I have written two scripts:
>
> (1) metapost.engine: runs your source file through 'mpost'.
> (2) metafun.engine: runs your source file through 'mpost -mem=metafun'
> and then processes the output with 'mptopdf'. This shouldn't be any
> different from processing the source files directly with mptopdf (the
> main reason why the script doesn't do that is because mptopdf doesn't
> understand filenametemplate).
>
> So, you should use (2) whenever you need features from MetaFun/ConTeXt.
> Unfortunately, the script that is run when you choose 'mptopdf' in
> TeXShop preferences is (1), not (2) - which is certainly confusing. I
> will ask Richard Koch to fix that.
>
> That said, (1) generates a preview document using LaTeX and (2)
> generates a preview document using ConTeXt (texexec). As you point out,
> the preview document is not meant to be included in other documents.
> But, (2) *does* output a pdf for each figure (with mptopdf). And (1)
> does it in the updated version attached below (when the variable
> \$CONVERTPDF is set to 1). In every case, the conversion to pdf is
> handled by mptopdf, so the bounding boxes should have the correct size.
>
> So, I suggest you to try the engines from TeXShop's Inactive folder or,
> even better, those attached below and report to me if you find bugs or
> have suggestions for improvements.
>
> Regards,
> Nicola
>
> PS: btw, has mptopdf been deprecated in favor of a different method (I
> think I've read something about that, but now I cannot remember)? If
> that is the case, is the new method still in development stage or is it
> stable?

Many thanks for your explanation! I tried your attached engine scripts and they work with the examples you supplied. However, consider this:

--
verbatimtex
\setupbodyfont[10pt]
etex

beginfig(1);
draw btex Hello world! etex;
endfig;

end
--

This is a typical example for my workflow where I need the labels to be typeset by ConTeXt. Apparently this is *not* what happens in your MetaFun script, see this mpxerr.log:

--
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009) (format=etex 2010.1.15)  17 JAN 2010 17:57
entering extended mode
%&-line parsing enabled.
**mp747443.tex
(./mp747443.tex
! Undefined control sequence.
l.1 \setupbodyfont
[10pt]%
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[1] [1] )
Output written on mp747443.dvi (2 pages, 296 bytes).
--

Suggestions?

Best wishes,
Oliver
`