* embed metapost figure into document @ 2020-11-09 21:57 Sylvain Hubert 2020-11-09 22:40 ` Jairo A. del Rio 0 siblings, 1 reply; 3+ messages in thread From: Sylvain Hubert @ 2020-11-09 21:57 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 542 bytes --] 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 [-- Attachment #1.2: Type: text/html, Size: 801 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: embed metapost figure into document 2020-11-09 21:57 embed metapost figure into document Sylvain Hubert @ 2020-11-09 22:40 ` Jairo A. del Rio 2020-11-10 0:23 ` Sylvain Hubert 0 siblings, 1 reply; 3+ messages in thread From: Jairo A. del Rio @ 2020-11-09 22:40 UTC (permalink / raw) To: mailing list for ConTeXt users, champignoom [-- Attachment #1.1: Type: text/plain, Size: 2482 bytes --] 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.: \starttext \startMPcode %\startuseMPgraphic{<name>} if you want to reuse your graphic with \useMPgraphic{<name>} draw fullcircle scaled cm %withcolor black % black is default ; \stopMPcode %\stopuseMPgraphic \stoptext 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: %nice.mp %"begin ... endfig", as well as "end" are important beginfig (1); draw fullcircle scaled cm %withcolor black ; endfig; end so when you compile it via mpost nice.mp (obviously supposing you have Metapost installed) you'll get a file called nice.1 and \starttext \externalfigure[nice.1][width=4cm] \stoptext 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@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@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 > > ___________________________________________________________________________________ > [-- Attachment #1.2: Type: text/html, Size: 4108 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: embed metapost figure into document 2020-11-09 22:40 ` Jairo A. del Rio @ 2020-11-10 0:23 ` Sylvain Hubert 0 siblings, 0 replies; 3+ messages in thread From: Sylvain Hubert @ 2020-11-10 0:23 UTC (permalink / raw) To: Jairo A. del Rio, mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 1730 bytes --] On Mon, 9 Nov 2020 at 23:40, Jairo A. del Rio <jairoadelrio6@gmail.com> wrote: > 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.: > > \starttext > \startMPcode %\startuseMPgraphic{<name>} if you want to reuse your graphic > with \useMPgraphic{<name>} > draw fullcircle scaled cm > %withcolor black % black is default > ; > \stopMPcode %\stopuseMPgraphic > \stoptext > > 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: > > %nice.mp > %"begin ... endfig", as well as "end" are important > beginfig (1); > draw fullcircle scaled cm > %withcolor black > ; > endfig; > end > > so when you compile it via > > mpost nice.mp > > (obviously supposing you have Metapost installed) you'll get a file called > nice.1 and > > \starttext > > \externalfigure[nice.1][width=4cm] > > \stoptext > > 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 :) > Hi Jairo, Thank you very much for the suggestion and the thorough explanation. I extracted the metapost code to a new file because I felt it would be a bit lengthy and noisy to stay with the text content. But you're right, an extra compilation step is not any better. I should probably use \component figure.tex, in place of \externalfigure[figure.1] Sylvain [-- Attachment #1.2: Type: text/html, Size: 2845 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-10 0:23 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-11-09 21:57 embed metapost figure into document Sylvain Hubert 2020-11-09 22:40 ` Jairo A. del Rio 2020-11-10 0:23 ` Sylvain Hubert
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).