[NTG-context] precompiling inline mp to pdf?

Willi Egger w.egger at boede.nl
Tue Nov 2 10:52:17 CET 2004


Hi Christopher,

In my case I prepared all the metapost code and had Context to prepare 
each figure as a \startTEXpage ... \stopTEXpage. Later I included the 
figures by referring to the different pages of that pdf-file.

\placefigure[margin][fig:sample]{none}{\externalfigure[mpfigure-pdf][page=27]}

Another aproach is to compile each figure in its own pdf-file. Hereafter 
I prepared a figure-database which in turn can be referenced whithin Context

<!-- Generation of a PDF file with the database: texexec --pdf 
--use=fig-make figure-lib.xml -->

<figurelibrary language="en">

    <description>
        <organization>Willi</organization>
        <project>Restauratie</project>
        <product>Restauratie-cursus </product>
        <comment>Figure database pictures from hand outs, own 
developments in METAPOST, Scans, WPG-WMF-EPS converted</comment>
    </description>

<figure>
    <file>example.pdf</file>
    <label>per_exemplum</label>
    <copyright>Scan and edited by WE</copyright>
    <comment> 4kB</comment>
</figure>

</figurelibrary>

In your source you will add \usefigurebase[base-figure-lib]
Hereafter you are able to call the pictures with

\placefigure[margin][ref]{caption}{\externalfigure[per_exemplum][width=0.45\makeupwidth,frame=off]}

I do hope this helps.


Willi

Christopher Creutzig wrote:

> Salvete,
> 
>  for my latest project (almost done, so I don't need the answer for this 
> one, but possibly in the future) I have compilation times which were 
> dominated by Metapost until I switched to using --nomp most of the time 
> and --automp --runs=2 whenever I changed something that results in 
> changes to the Metapost stuff.  (I needed the --automp anyway, since to 
> work around size limits in MetaPost I had to split the background into 
> separate images, yet they had to influence one another via global 
> variables -- increasing the memory limit to 80 MB made Metapost 
> predictably freeze at unpredictable places in the run.)
> 
>  Now, my compile times are dominated by the mp to pdf conversion. Since 
> pdf inclusion is fast (as expected), I'd like to use mptopdf once on 
> each generated file and have ConTeXt include that.  Should I redefine 
> \insertMPfile to first look for the pdf or is there a more clever way? 
> (Note that I do want the automatic inclusion, since I'm passing the 
> dimensions of external figures etc. to metapost and use the result in a 
> background layer and/or as frame backgrounds.)
> 
> regards,
>     Christopher Creutzig
> 
> PS: I didn't have time to analyze this when I came across it, but it 
> seems that "texexec --automp file" consistently performs one TeX run too 
> little.  In any case, the last thing it does is a metapost run, which 
> doesn't seem sensible to me.
> 
> 
> _______________________________________________
> ntg-context mailing list
> ntg-context at ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context


More information about the ntg-context mailing list