5

My understanding is that Context has a pretty diverse core base load. But I was curious if asymptote code blocks can be used in a context document?

I am used to calling packages at the beginning of a LaTex document but am unsure and have not found a good example of using either asymptote or ams math.

I am thinking the functionality of ams is included in the Context core but I cannot imagine that asymptote functionality is part of the context core.

It is my understanding that there is a TikZ module for Context. When I did the setup I included all modules. How do I verify (what command) what modules have been loaded as part of the Context setup?

1
  • »How do I verify (what command) what modules have been loaded as part of the Context setup?« I don't understand this part of the question. Could you please elaborate? Commented May 8, 2017 at 1:45

1 Answer 1

9

Asymptote

How to use Asymptote was demonstrated by Aditya on the mailing list.

\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

TikZ

The TikZ manual describes the usage for all three common formats, LaTeX, Plain TeX, and ConTeXt. Be aware that TikZ uses a different colour model than ConTeXt which can lead to strange interactions, see for example this post on the mailing list.

enter image description here

AMSmath

There is no amsmath for ConTeXt. However, the ConTeXt core implements most of the major functionality for which you would use amsmath in LaTeX.

There is a great article by Aditya in the MAPS journal on how to emulate certain popular AMSmath constructs in ConTeXt.

Display Math in ConTEXt

ConTEXt rehab for amsmath addicts

https://www.ntg.nl/maps/34/06.pdf

2
  • Henri how is filter={asy -tex "context" -outformat pdf providing an asymptote process link into the document? Is it because as long as I have the asymptote binary in the computer path this will give context the link it needs to use the asymptote processing functionality?
    – Tim C.
    Commented May 8, 2017 at 14:21
  • @TimC: see the documentation of the filter module. Behind the scenes, the filter module writes the file to disk, runs the filtercommand on the file and then reads the output.
    – Aditya
    Commented May 8, 2017 at 16:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .