[NTG-context] Asymptote or Metapost and ConTeXt parameters.

Jaroslav Hajtmar hajtmar at gyza.cz
Tue Dec 20 11:34:09 CET 2016

Thanx Aditya 
very much for your Metapost example. This I certainly sufficient for the production of simple images for my ideas. I attach source code, which outlines how I imagined inserting Asymptote images into Context. In the lower part of commented code is fully functional, compiled ConTEXt of TeX Live 2016 (included in the package is also Asymptote). My idea is that Asymptote code is part of my ConTeXt macro and parameters of macro are passed into Asymptote. My example does not work because Asymptote is probably not enough linked with Context. I am very grateful that You would to deal with my problem. 

I am not sure whether it will do Asymptote example as in the case Metapost. That's why I use  filter in my own example (taken from https://mailman.ntg.nl/pipermail/ntg-context/2015/080581.html ).

Thank you once again.

Jaroslav Hajtmar


     filter={asy -tex "context" -outformat pdf
             -outname \externalfilteroutputfile},


	import graph;


%% simple asymptote example (compiled ConTeXt (LuaTeX) from TeX Live 2016)
%   [ASY]
%   [
%     filter={asy -tex "context" -outformat pdf
%             -outname \externalfilteroutputfile},
%     output=\externalfilterbasefile.pdf,
%     cache=yes,
%     readcommand=\ReadImage,
%   ]
%import graph;

Dne 19.12.16 17:19, ntg-context za uživatele Aditya Mahajan <ntg-context-bounces at ntg.nl za uživatele adityam at umich.edu> napsal(a):

    On Mon, 19 Dec 2016, Jaroslav Hajtmar wrote:
    > There is a similar possibility, at least in Metapost? For simpler 
    > pictures it would probably suffice ....
    The ability to pass parameters to metapost has been around since the 
    beginning. See the metafun manual for details (search for MPvar). For 
    simple images, you can also do:
    \define[1]\Circle{\startMPcode draw fullcircle scaled #1*cm; \stopMPcode}
    \Circle{1} \Circle{2} \Circle{3}
    > Is there a way to pass the ConTeXt parameter which influenced the 
    > creation of the Asymptote image? My point eg. the ability to define 
    > macros, which gave its parameters to Asymptote procedure or function and 
    > depending on these parameters, the image created by Asymptote looked 
    > differently.
    In principle, something similar to \MPvar can work for asymptote as well 
    (or one could do parse the content in Lua rather than expand variables in 
    > Before starting work on an illustrative example I am asking, whether it 
    > makes sense to deal with such a thing ... I suppose the impossibility of 
    > combining asymptote code and such Lua code (or not?).
    ConTeXt and Metapost are very well integrated, even in MkII. The same 
    ideas could work with other graphic backends as well (Asymptote, tikz, and 
    others). But it does require a good knowledge of the graphics package.
    I am willing to write the code at the context end, if someone who knows 
    asymptote can tell me what needs to be done at the asymptote end.
    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

More information about the ntg-context mailing list