New answers tagged

3

This is a primitive example of an animation, which shows what happens if you increase the viscosity. The various parameters are stored in pgf keys (except for the number of layers because the parse=true option of foreach doesn't work well with integers). The bounding box gets recorded in the aux file. \documentclass[tikz,border=3mm]{standalone} \...


0

You can have both, interactive 3D content that opens on click and a nicely rendered vector image for printing and PDF viewers that don't support PRC. For this, add import three; settings.render = 0; at top of the asy code. Compile example.tex with pdflatex example asy example-1.asy pdflatex example Input example.tex: \documentclass[varwidth,border=3pt]{...


1

Schrödinger's cat mentioned this post where O.G. uses the maxtile trick to solve the graphic card issue. I tested it and it works: settings.outformat="pdf"; settings.prc = false; settings.render = 0; import three; currentprojection=orthographic(5,4,2,center=true); size(5cm); size3(3cm,5cm,8cm); draw(unitbox); dot(unitbox,red); label("$O$",(0,0,0),NW); ...


2

It looks like there is a command texpreamble that might do what you need. From https://sourceforge.net/p/asymptote/discussion/409349/thread/abc87704/ : In the file config.asy you can set autoimport="common"; and, in the file common.asy, you must put: texpreamble("\newcommand{\U}{\underline}"); Regards.


2

I'm sure, there is a better and proper way to achieve this, but a quick-and-dirty fix is this: copy plain.asy to the directory of those asy files and insert the line usepackage("siunitx"); at the end of it. Actually, the code in the plain.asy suggests that if there is a command specified in settings.command, the Asymptote executes it and exits ...


5

My solution is a more automated version of the answer from @chishimotoji. My code breaks all the paths up into subpaths and then automatically determines which should be plotted using inside(path p, pair z) functions. I created the isOutside and getOuterSubpaths functions as defined below. Using these functions, you will only need to define the paths, ...


7

This is raw code! Clean code should be written by yourself. unitsize(1cm); guide U = circle( (0,0), 1), E = ellipse( (0,0), 1.3, 0.6 ), B = box( (-1.2, -0.5), (1.2,0.5) ), Bo = box( (-0.4, -1.2), (0.4,1.2) ), all[] = U ^^ E ^^ B ^^ Bo; pair[] Int=intersectionpoints(U,Bo); pair[] Intt=intersectionpoints(U,B); pair[] IntT=...


5

One can plot this very easily if one knows the polar coordinate representations of the rectangle and ellipse. Here is the asymptote code: \documentclass[varwidth,border=3mm]{standalone} \usepackage{asymptote} \begin{document} \begin{asy} settings.outformat="pdf"; import graph; size(8cm,0); real rrect(real a,real b,real t) { return 1/max(abs(cos(t)/a),...


Top 50 recent answers are included