[NTG-context] embed metapost figure into document

Jairo A. del Rio jairoadelrio6 at gmail.com
Mon Nov 9 23:40:14 CET 2020

Hi, Sylvain.

LuaMetaTeX and LuaTeX, the engines used by ConTeXt nowadays, use an
embedded library, so external compilations/files are not necessary. Just
out of curiosity, wouldn't it be easier to use a ConTeXt environment? E.g.:

\startMPcode %\startuseMPgraphic{<name>} if you want to reuse your graphic
with \useMPgraphic{<name>}
    draw fullcircle scaled cm
    %withcolor black % black is default
\stopMPcode %\stopuseMPgraphic

More info here: https://wiki.contextgarden.net/MetaFun_-_MetaPost_in_ConTeXt
To actually answer your question, if you actually want to load a Metapost
graphic externally generated, you should have something like:

%"begin ... endfig", as well as "end" are important
beginfig (1);
draw fullcircle scaled cm
%withcolor black

so when you compile it via

mpost nice.mp

(obviously supposing you have Metapost installed) you'll get a file called
nice.1 and




will work. However, as you can see, ConTeXt deals with such minutiae for
you and extends Metapost capabilities too, so the second alternative is not
the ConTeXt way to go.

I hope it helps.

Jairo :)

El lun., 9 de nov. de 2020 a la(s) 16:59, Sylvain Hubert (
champignoom at gmail.com) escribió:

> Dear List,
> I'm trying to embed a metapost image into the document. According the MetaFun
> manual <http://www.pragma-ade.com/general/manuals/metafun-p.pdf>,
> "embedding such a graphic is done by:
> \externalfigure[graphic.123][width=4cm]", but the following example
> produces an empty page:
>     % test.mkxl
>     \starttext
>     \externalfigure[test.123][width=4cm]
>     \stoptext
>     % test.123
>     draw fullcircle scaled cm withcolor black;
> Does anyone know how to properly embed a metapost image into a context
> document?
> Thanks!
> Best,
> Sylvain
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
> maillist : ntg-context at ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20201109/3f83d178/attachment.htm>

More information about the ntg-context mailing list