On Fri, 2 Jan 2015, Context NTG wrote:

Here is an Asymptote example

unitsize(1cm);
draw((-.1,0) -- (2,0),
arrow=Arrow(TeXHead));
draw((0,-.1) -- (0,2), arrow =
Arrow(TeXHead));
draw((0,0) .. (1,1) .. (2,sqrt(2)));


Below is how I have started setting this up in Context. This creates a pdf
file with the drawing, but it is not included in the final docuement.

Sorry for the late reply. You just need to change a few options:

\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
      unitsize(1cm);
      draw((-.1,0) -- (2,0), arrow=Arrow(TeXHead));
      draw((0,-.1) -- (0,2), arrow=Arrow(TeXHead));
      draw((0,0) .. (1,1) .. (2,sqrt(2)));
    \stopASY
  \stopplacefigure
\stoptext

Here \startASY behaves similar to \startMPcode. To get something similar to \startMPenvironment in mkii, you can use beforebuffer.

Aditya
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to