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

Nicola nvitacolonna at gmail.com
Sun Jan 17 15:12:47 CET 2010


In article <A6F61C29-A869-42A8-8C0C-AC75F8A7BB0B at mpq.mpg.de>,
 Oliver Buerschaper <oliver.buerschaper at mpq.mpg.de> wrote:

> > I have written the scripts to typeset MetaPost files from TeXShop (when 
> > you choose 'mptopdf' in the Preferences). I cannot reproduce the 
> > problems you mention. Maybe you could send me a source file that 
> > exhibits the bug?
> 
> It doesn't surprise me that you cannot reproduce the bug since I wrote my own 
> engine script (which calls mptopdf directly):
> 
> ---
> #!/bin/bash
> 
> mptopdf "$1"
> ---
> 
> I did this for two reasons: first I need ConTeXt to be run for labels (since 
> I want OpenType math labels, for instance, and also because I found it easier 
> to get arbitrary font sizes with ConTeXt). Your script appears to call LaTeX 
> behind the curtains for this task.
>
> Second, the current format of the single PDF file that's produced by your 
> script almost fits my needs but not quite. In my opinion your idea of 
> providing real PDF preview for MetaPost is brilliant, no doubt about that. 
> However, I need to include these MetaPost figures in another document which 
> means I need to be able to access them individually. Unfortunately, there are 
> no individual PDF files for the figures. Also I cannot extract single pages 
> from the comprehensive PDF with say
> 
> \includegraphics[page=x]{mpost_output.pdf}
> 
> because of the titles you add. In a comprehensive PDF file I'd also need each 
> page size to equal the bounding box of the respective figure.

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?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Engines.tar.bz2
Type: application/octet-stream
Size: 23771 bytes
Desc: not available
URL: <http://tug.org/pipermail/metapost/attachments/20100117/4d2858de/attachment-0001.obj>


More information about the metapost mailing list