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

Hans Hagen pragma at wxs.nl
Mon Dec 19 10:43:56 CET 2016


On 12/19/2016 10:10 AM, Fabrice Couvreur wrote:
> Hello,
> I do not answer the question, but I'm interested because I also use
> Asymptote. The following code works with context in texlive 2016 but
> does not work with standalone context.
> thank you,

it probably depends on what you want to pass as info (i don't have 
asymptote installed nor time to check it) but if the code you pass gets 
expanded then you can add expandable macros or \the\foo kind of code to it

Hans

> Fabrice
> % macros=mkvi
>
> \usemodule[filter]
>
> \defineexternalfilter
>    [ASY]
>    [
>      filter={asy -tex "context" -outformat pdf
>              -outname \externalfilteroutputfile},
>      output=\externalfilterbasefile.pdf,
>      cache=yes,
>      readcommand=\ReadImage,
>    ]
>
> \define[1]\ReadImage{\externalfigure[#1]}
>
> \starttext
>    Testing if we can include an asymptote image
>    \startplacefigure[location={here}, title={An Asymptote figure}]
>      \startASY
>        import three;
> size(8cm,0);
> currentlight.background=black;
>
> material White(real x, real y){
>    return material(diffusepen=gray(.05+.1x+.3y),
>                    emissivepen=gray(.05+.1x+.3y));
> }
>
> for(int y=0; y<=2; ++y)
>     for(int x=0; x<3; ++x)
>         draw(shift(2x,2y,0)*unitsphere,White(x,y));
>      \stopASY
>    \stopplacefigure
> \stoptext
>
>
> 2016-12-19 8:41 GMT+01:00 Jaroslav Hajtmar <hajtmar at gyza.cz
> <mailto:hajtmar at gyza.cz>>:
>
>     Hello ConTeXtist,____
>
>     I saw the opportunity to insert an Asymptote picture into Context
>     source code (due filter).____
>
>     For example here:
>     https://mailman.ntg.nl/pipermail/ntg-context/2015/080581.html
>     <https://mailman.ntg.nl/pipermail/ntg-context/2015/080581.html>____
>
>     __ __
>
>     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.____
>
>     __ __
>
>     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?).____
>
>     __ __
>
>     There is a similar possibility, at least in Metapost? For simpler
>     pictures it would probably suffice ....____
>
>     __ __
>
>     Thanx ____
>
>     Jaroslav Hajtmar____
>
>     __ __
>
>
>     ___________________________________________________________________________________
>     If your question is of interest to others as well, please add an
>     entry to the Wiki!
>
>     maillist : ntg-context at ntg.nl <mailto:ntg-context at ntg.nl> /
>     http://www.ntg.nl/mailman/listinfo/ntg-context
>     <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/
>     <https://bitbucket.org/phg/context-mirror/commits/>
>     wiki     : http://contextgarden.net
>     ___________________________________________________________________________________
>
>
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list