ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Re: Status of Asymptote
Date: Sun, 31 Dec 2023 00:33:40 +0100 (CET)	[thread overview]
Message-ID: <511q1rpp-2494-751o-o807-0p87ns24q4po@hzvpu.rqh> (raw)
In-Reply-To: <b2b8da4a-898f-45fa-8155-13f81cef8f5a@gmail.com>

On Sun, 31 Dec 2023, Shiv Shankar Dayal wrote:

> It would be nice to either support Metapost 3D or Asymptote. Right now I
> generate images separately and embed them in PDF using externalfigure command which works but I have to maintain all the graphics separately.

It is possible to obtain simple integration for asymptote using the filter module:

  https://github.com/adityam/filter

Using that you could define an asymptote environment so that:

\startbuffer[asymptote-preamble]
....
\stopbuffer

\starttext

\startasymptote
% Asymptote figure
\stopasymptote

\stoptext

saves the content of the asymptote-preamble and the figure in a separate file, runs asymptote to generate a PDF figure and includes the figure. The results are cached so the asymptote is re-run only if the content of the figure environment changes. 

A drawback of this approach is that the labels are generated by asymptote. That means that the font, colors, and any macros needed for the figures need to be redefined at both context and asymptote end. 

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2023-12-30 23:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06  8:43 Alexandre Christe via ntg-context
2021-12-06 15:11 ` Gavin via ntg-context
2021-12-06 17:33   ` Fabrice L via ntg-context
2021-12-07  6:29 ` Aditya Mahajan via ntg-context
2021-12-07  8:42   ` Hans Hagen via ntg-context
2023-12-30 19:04     ` [NTG-context] " Shiv Shankar Dayal
2023-12-30 20:33       ` Gavin via ntg-context
2023-12-30 20:44       ` Alan Braslau via ntg-context
2023-12-30 21:48       ` Hans Hagen
2023-12-30 23:33       ` Aditya Mahajan [this message]
2024-01-03 11:39         ` Jeroen
2024-01-11  6:00           ` shivshankar.dayal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=511q1rpp-2494-751o-o807-0p87ns24q4po@hzvpu.rqh \
    --to=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).