* Asymptote in Context @ 2014-12-24 21:41 Context NTG 2014-12-28 7:21 ` Aditya Mahajan 0 siblings, 1 reply; 10+ messages in thread From: Context NTG @ 2014-12-24 21:41 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 93 bytes --] Could anybody explain how to use Asymptote in ConTeXt with the filter module. Thanks Jeroen [-- Attachment #1.2: Type: text/html, Size: 159 bytes --] [-- Attachment #2: Type: text/plain, Size: 485 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Asymptote in Context 2014-12-24 21:41 Asymptote in Context Context NTG @ 2014-12-28 7:21 ` Aditya Mahajan 2014-12-28 11:04 ` Mojca Miklavec 0 siblings, 1 reply; 10+ messages in thread From: Aditya Mahajan @ 2014-12-28 7:21 UTC (permalink / raw) To: mailing list for ConTeXt users 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? 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Asymptote in Context 2014-12-28 7:21 ` Aditya Mahajan @ 2014-12-28 11:04 ` Mojca Miklavec 2014-12-28 16:51 ` OT: " Alan BRASLAU 2015-01-02 22:14 ` Context NTG 0 siblings, 2 replies; 10+ messages in thread From: Mojca Miklavec @ 2014-12-28 11:04 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1: Type: text/plain, Size: 1017 bytes --] 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 [-- Attachment #2: cylinder.asy --] [-- Type: application/octet-stream, Size: 2236 bytes --] settings.outformat="pdf"; settings.render=0; settings.prc=false; // asy -tex context cylinder.asy texpreamble("\setupbodyfont[lucidaot,8pt]"); //defaultpen(fontsize(8pt)); defaultpen(font("lucidaot", 8.0)); import solids; size(0,120); // Return a right circular cylinder of height h in the direction of axis // based on a circle centered at c with radius r. revolution halfcylinder(triple c=O, real r, real h, triple axis=Z, real angle1=0, real angle2=360) { triple C=c+r*perp(axis); axis=h*unit(axis); return revolution(c,C--C+axis,axis,angle1,angle2); } revolution halfthickcylinder(triple c=O, real r1, real r2, real h, triple axis=Z, real angle1=0, real angle2=360) { triple C=c+r1*perp(axis); triple dC=(r2-r1)*perp(axis); axis=h*unit(axis); return revolution(c,C--C+axis--C+axis+dC--C+dC--cycle,axis,angle1,angle2); } currentlight=light(4,-5,5); currentprojection=orthographic(2,-5,0.6); real r1=0.50, r2=0.52, h=0.40; real px=0.1, py=px, pz=0.2; real phi1=5, phi2=165; surface patient = scale(px,py,pz)*shift(-0.5,-0.5,-0.5)*unitcube; revolution ring1=rotate(-90,Y)*shift(0,-h/2,0)*halfthickcylinder(O,r1,r2,h,Y,phi1,phi2); revolution ring2=yscale3(-1)*ring1; real dax = 0.2; draw((r2,0,r2)--(r2,0,r2+dax),blue,Arrow3); label("$z$", (r2,0,r2+dax), N, blue); draw((r2,0,r2)--(r2,dax,r2),green,Arrow3); label("$y$", (r2,dax,r2), NE, green); draw((r2,0,r2)--(r2+dax,0,r2),red,Arrow3); label("$x$", (r2+dax,0,r2), E, red); draw(surface(ring2),yellow); draw(O--(rotate(-phi1,Y)*scale3(r2)*Z),dashed); draw(O--(rotate(-phi2,Y)*scale3(r2)*Z),dashed); label(format("$%.0f°$", phi1), (rotate(-phi1,Y)*scale3(r2)*Z), N); label(format("$%.0f°$", phi2), (rotate(-phi2,Y)*scale3(r2)*Z), S); real ax(real t) {return 0.5*r2*cos(t);} real ay(real t) {return 0.5*r2*sin(t);} real az(real t) {return 0;} path3 ap=graph(ay,az,ax,0,-pi*phi2/180,operator ..); draw(ap,Arrow3); label("$\phi$", (rotate(-phi2/2,Y)*scale3(r2/2)*Z), W); draw(scale3(-pz/2)*Z--scale3(-r2)*Z,red); draw(scale3(-pz/2)*Z--scale3(pz/2)*Z,red+dashed); draw(patient, blue+opacity(.7), 0.4bp+black); draw(scale3(pz/2)*Z--scale3(r2)*Z,red); draw(surface(ring1),yellow); path3 ah = rotate(-30,Y)*shift(r2,0,0)*scale3(0.5*h)*((0,-1,0)--(0,1,0)); [-- Attachment #3: cylinder.pdf --] [-- Type: application/pdf, Size: 57748 bytes --] [-- Attachment #4: Type: text/plain, Size: 485 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: OT: Asymptote in Context 2014-12-28 11:04 ` Mojca Miklavec @ 2014-12-28 16:51 ` Alan BRASLAU 2014-12-28 17:07 ` luigi scarso 2014-12-28 18:44 ` Mojca Miklavec 2015-01-02 22:14 ` Context NTG 1 sibling, 2 replies; 10+ messages in thread From: Alan BRASLAU @ 2014-12-28 16:51 UTC (permalink / raw) To: Mojca Miklavec; +Cc: mailing list for ConTeXt users 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 <mojca.miklavec.lists@gmail.com> wrote: > 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 ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: OT: Asymptote in Context 2014-12-28 16:51 ` OT: " Alan BRASLAU @ 2014-12-28 17:07 ` luigi scarso 2014-12-29 15:03 ` Alan BRASLAU 2014-12-28 18:44 ` Mojca Miklavec 1 sibling, 1 reply; 10+ messages in thread From: luigi scarso @ 2014-12-28 17:07 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 551 bytes --] On Sun, Dec 28, 2014 at 5:51 PM, Alan BRASLAU <alan.braslau@cea.fr> 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 -- luigi [-- Attachment #1.2: Type: text/html, Size: 1084 bytes --] [-- Attachment #2: Type: text/plain, Size: 485 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: OT: Asymptote in Context 2014-12-28 17:07 ` luigi scarso @ 2014-12-29 15:03 ` Alan BRASLAU 2014-12-29 15:27 ` Arthur Reutenauer 0 siblings, 1 reply; 10+ messages in thread From: Alan BRASLAU @ 2014-12-29 15:03 UTC (permalink / raw) To: luigi scarso; +Cc: mailing list for ConTeXt users On Sun, 28 Dec 2014 18:07:38 +0100 luigi scarso <luigi.scarso@gmail.com> wrote: > On Sun, Dec 28, 2014 at 5:51 PM, Alan BRASLAU <alan.braslau@cea.fr> > 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 ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: OT: Asymptote in Context 2014-12-29 15:03 ` Alan BRASLAU @ 2014-12-29 15:27 ` Arthur Reutenauer 0 siblings, 0 replies; 10+ messages in thread From: Arthur Reutenauer @ 2014-12-29 15:27 UTC (permalink / raw) To: mailing list for ConTeXt users > 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 ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: OT: Asymptote in Context 2014-12-28 16:51 ` OT: " Alan BRASLAU 2014-12-28 17:07 ` luigi scarso @ 2014-12-28 18:44 ` Mojca Miklavec 1 sibling, 0 replies; 10+ messages in thread From: Mojca Miklavec @ 2014-12-28 18:44 UTC (permalink / raw) To: Alan BRASLAU; +Cc: mailing list for ConTeXt users 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 ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Asymptote in Context 2014-12-28 11:04 ` Mojca Miklavec 2014-12-28 16:51 ` OT: " Alan BRASLAU @ 2015-01-02 22:14 ` Context NTG 2015-01-20 3:39 ` Aditya Mahajan 1 sibling, 1 reply; 10+ messages in thread From: Context NTG @ 2015-01-02 22:14 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 2478 bytes --] 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 <mojca.miklavec.lists@gmail.com>: > 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 > > > ___________________________________________________________________________________ > 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 > > ___________________________________________________________________________________ > [-- Attachment #1.2: Type: text/html, Size: 3559 bytes --] [-- Attachment #2: Type: text/plain, Size: 485 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Asymptote in Context 2015-01-02 22:14 ` Context NTG @ 2015-01-20 3:39 ` Aditya Mahajan 0 siblings, 0 replies; 10+ messages in thread From: Aditya Mahajan @ 2015-01-20 3:39 UTC (permalink / raw) To: mailing list for ConTeXt users 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-01-20 3:39 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-12-24 21:41 Asymptote in Context Context NTG 2014-12-28 7:21 ` Aditya Mahajan 2014-12-28 11:04 ` Mojca Miklavec 2014-12-28 16:51 ` OT: " Alan BRASLAU 2014-12-28 17:07 ` luigi scarso 2014-12-29 15:03 ` Alan BRASLAU 2014-12-29 15:27 ` Arthur Reutenauer 2014-12-28 18:44 ` Mojca Miklavec 2015-01-02 22:14 ` Context NTG 2015-01-20 3:39 ` Aditya Mahajan
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).