Could anybody explain how to use Asymptote in ConTeXt with the filter module. Thanks Jeroen
Dear Aditya, On Sun, Dec 28, 2014 at 8:21 AM, Aditya Mahajan wrote:
On Wed, 24 Dec 2014, Context NTG wrote:
Could anybody explain how to use Asymptote in ConTeXt with the filter module.
Can you post a minimal asymptote file and how it shoud be processed via the command line?
I have no time to create a nice minimal example, but here's an ugly non-minimal example which should at least enable you to test the interaction with the filter module. I also added one ConTeXt-specific command while trying to make math fonts work properly, just replace "lucidaot" with another font in case you don't have that one installed. You can run the example with asy -tex context cylinder.asy (Maybe it's possible to set the tex engine inside the file as well.) Bonus points if you can get PRC to work properly before TL 2015. Or if you can make the file print properly from OS X without using Acrobat or ghostscript/CUPS. Preview.app "forgets" to print the (smoothly shaded) cylinder for example. Mojca
Sorry, but I fail to see what the 3D aspect of this drawing brings to
anything, other than to impress the gallery and look spiffy.
I guess that we belong now to a society without any imagination,
requiring lots of colors, shadowing (and even animation) in order to
get an idea across...
(At least make use of the third dimension to describe SOMETHING if you
are going to include it.)
Alan
(who is being chastised by Hans for attempting to plot 100k data
points.)
P.S. the green y-axis looks really odd in your example.
On Sun, 28 Dec 2014 12:04:55 +0100
Mojca Miklavec
Dear Aditya,
On Sun, Dec 28, 2014 at 8:21 AM, Aditya Mahajan wrote:
On Wed, 24 Dec 2014, Context NTG wrote:
Could anybody explain how to use Asymptote in ConTeXt with the filter module.
Can you post a minimal asymptote file and how it shoud be processed via the command line?
I have no time to create a nice minimal example, but here's an ugly non-minimal example which should at least enable you to test the interaction with the filter module.
I also added one ConTeXt-specific command while trying to make math fonts work properly, just replace "lucidaot" with another font in case you don't have that one installed.
You can run the example with asy -tex context cylinder.asy
(Maybe it's possible to set the tex engine inside the file as well.)
Bonus points if you can get PRC to work properly before TL 2015. Or if you can make the file print properly from OS X without using Acrobat or ghostscript/CUPS. Preview.app "forgets" to print the (smoothly shaded) cylinder for example.
Mojca
On Sun, Dec 28, 2014 at 5:51 PM, Alan BRASLAU
Sorry, but I fail to see what the 3D aspect of this drawing brings to anything, other than to impress the gallery and look spiffy.
I guess that we belong now to a society without any imagination, requiring lots of colors, shadowing (and even animation) in order to get an idea across...
(At least make use of the third dimension to describe SOMETHING if you are going to include it.)
http://www.pdf3d.com/gallery.php shows other examples
-- luigi
On Sun, 28 Dec 2014 18:07:38 +0100
luigi scarso
On Sun, Dec 28, 2014 at 5:51 PM, Alan BRASLAU
wrote: Sorry, but I fail to see what the 3D aspect of this drawing brings to anything, other than to impress the gallery and look spiffy.
I guess that we belong now to a society without any imagination, requiring lots of colors, shadowing (and even animation) in order to get an idea across...
(At least make use of the third dimension to describe SOMETHING if you are going to include it.)
http://www.pdf3d.com/gallery.php shows other examples
I guess that "impress the gallery" is a translation of an expression in French referring to the upper, low-price, standing room only balcony in theaters, populated by an audience that is easily impressed... Sorry, but I insurge against the frequent, abusive misuse of 3d-like illustrations common in PowerPoint and other MSWord documents. Sometimes, it is useful to illustrate something in perspective; in most cases this turns out to be very marginal - nothing more than "eye candy" - makes life sweeter! Alan
I guess that "impress the gallery" is a translation of an expression in French referring to the upper, low-price, standing room only balcony in theaters, populated by an audience that is easily impressed...
Actually, it's "amuser la galerie" - amuse / entertain the gallery, rather than impress it. Arthur
On Sun, Dec 28, 2014 at 5:51 PM, Alan BRASLAU wrote:
Sorry, but I fail to see what the 3D aspect of this drawing brings to anything, other than to impress the gallery and look spiffy.
Just to make it clear: this wasn't an example for the gallery, but more or less the only asymptote example on my hard drive (excluding examples from the manual), just to help Aditya and Jeroen play with something.
I guess that we belong now to a society without any imagination, requiring lots of colors, shadowing (and even animation) in order to get an idea across...
Well, if you want to be a purist: why do you need figures at all? One can easily represent all the data in tables and describe images like this one in pure mathematical formulation.
P.S. the green y-axis looks really odd in your example.
I know, but I don't know the reason for that "weirdness". I added the axis just because I kept forgetting orientation of axes – the axes themselves weren't part of the drawing, so I didn't try to search for solution to make it look better. Mojca
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.
\defineexternalfilter
[ASY]
[filtercommand={asy -tex "context" -View -outformat pdf -outname
\externalfilteroutputfile\space \externalfilterinputfile},
output=\externalfilterbasefile.out,
readcommand=\typefile,
cache=force,
location=text,
continue=yes]
\starttext
\startASY[myplot]
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
\externalfigure[myplot]
\stoptext
Thanks
Jeroen
2014-12-28 12:04 GMT+01:00 Mojca Miklavec
Dear Aditya,
On Wed, 24 Dec 2014, Context NTG wrote:
Could anybody explain how to use Asymptote in ConTeXt with the filter module.
Can you post a minimal asymptote file and how it shoud be processed via
On Sun, Dec 28, 2014 at 8:21 AM, Aditya Mahajan wrote: the
command line?
I have no time to create a nice minimal example, but here's an ugly non-minimal example which should at least enable you to test the interaction with the filter module.
I also added one ConTeXt-specific command while trying to make math fonts work properly, just replace "lucidaot" with another font in case you don't have that one installed.
You can run the example with asy -tex context cylinder.asy
(Maybe it's possible to set the tex engine inside the file as well.)
Bonus points if you can get PRC to work properly before TL 2015. Or if you can make the file print properly from OS X without using Acrobat or ghostscript/CUPS. Preview.app "forgets" to print the (smoothly shaded) cylinder for example.
Mojca
___________________________________________________________________________________ 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
___________________________________________________________________________________
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
participants (6)
-
Aditya Mahajan
-
Alan BRASLAU
-
Arthur Reutenauer
-
Context NTG
-
luigi scarso
-
Mojca Miklavec