ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Jaroslav Hajtmar <hajtmar@gyza.cz>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Asymptote or Metapost and ConTeXt parameters.
Date: Fri, 23 Dec 2016 08:02:38 +0000	[thread overview]
Message-ID: <D12263DC-BE95-4B19-8405-43B2988F72AD@gyza.cz> (raw)
In-Reply-To: <alpine.OSX.2.02.1612212043440.63924@nqv-znpobbx>

Hello Adytia.
Thanks for sending Your code. It seems that it works with Asymptote. Unfortunately, when I am trying to multiple call a macro then I get fatal error, and then compile collapse. I do not know what it could be. Is it possible that my code is wrong. But it is possible that there is a stack overflow etc. It would be a need to look at why the fatal error occurs - It probably can evaluate Hans. Thanks again for your support. Below is my code. If removed commentary characters occurs advised error.

Jaroslav Hajtmar


\usemodule[filter]

\defineexternalfilter
   [ASY]
   [
     filtercommand={asy -tex context \externalfilterinputfile\space -o \externalfilteroutputfile}, output=\externalfilterbasefile.pdf,
     purge=no, 
     cache=yes,
     readcommand=\ReadImage,
   ]

\define[1]\ReadImage{\externalfigure[#1]}

\define[1]\mycircle{
#1 - XXX
\setbuffer[ASY]
	import graph;
	draw(Circle((0,0),#1));
\endbuffer
\processASYbuffer[ASY]
}

\starttext
AAA
\startASY
	import graph;
	draw((0,0)--(100,100));
\stopASY

BBB
\mycircle{100}


%CCC
%\mycircle{50}

%DDD
%\mycircle{200}

\stoptext





Dne 22.12.16 5:49, ntg-context za uživatele Aditya Mahajan <ntg-context-bounces@ntg.nl za uživatele adityam@umich.edu> napsal(a):

    On Tue, 20 Dec 2016, Jaroslav Hajtmar wrote:
    
    > very much for your Metapost example. This I certainly sufficient for the 
    > production of simple images for my ideas.
    
    > \define[1]\mycircle{
    > 	\startASY
    > 	import graph;
    > 	draw(Circle((0,0),#1));
    > 	\stopASY
    > }
    >
    > \starttext
    > \mycircle{20}
    > \mycircle{30}
    > \mycircle{40}
    > \stoptext
    
    It is already feasible to define something this simple using the filter 
    module. I don't have asymptote installed on the machine that I am 
    currently working on, but here is an example that uses pandoc.
    
    \usemodule[filter]
    
    \defineexternalfilter
         [MARKDOWN]
         [
           filtercommand={pandoc -f markdown -t context \externalfilterinputfile\space -o \externalfilteroutputfile},
           cache=yes,
           purge=no, % Just for testing. May be removed.
         ]
    
    \define[1]\TEST
         {\setbuffer[MARKDOWN]This is #1\endbuffer
          \processMARKDOWNbuffer[MARKDOWN]}
    
    \starttext
    \startMARKDOWN
       This is **one**
    \stopMARKDOWN
    
    \TEST{**ONE**}
    
    \TEST{_TWO_}
    \stoptext
    
    With this method, the results are not cached. Let me know if this works 
    for your needs.
    
    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://context.aanhet.net
    archive  : 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@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
___________________________________________________________________________________

  reply	other threads:[~2016-12-23  8:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19  7:41 Jaroslav Hajtmar
2016-12-19  9:10 ` Fabrice Couvreur
2016-12-19  9:43   ` Hans Hagen
2016-12-19 16:19 ` Aditya Mahajan
2016-12-20 10:34   ` Jaroslav Hajtmar
2016-12-22  4:49     ` Aditya Mahajan
2016-12-23  8:02       ` Jaroslav Hajtmar [this message]
2016-12-23 19:22         ` Aditya Mahajan
2016-12-23 20:28           ` Hans Hagen
2016-12-24  2:55           ` Jaroslav Hajtmar
2016-12-24  3:05             ` Aditya Mahajan
2016-12-20 22:14   ` Alan Braslau
2016-12-21  7:49     ` Aditya Mahajan
2017-03-19 18:01     ` Passing data back and forth between metapost and lua Aditya Mahajan
2017-03-19 18:29       ` Aditya Mahajan
2017-03-19 19:02         ` Hans Hagen

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=D12263DC-BE95-4B19-8405-43B2988F72AD@gyza.cz \
    --to=hajtmar@gyza.cz \
    --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).