TeX Community Aggregator

Category Asymptote examples (various authors)

Chains of Rings

% chain.tex : % \begin{filecontents*}{chainofrings.asy} struct chainOfRings{ int n; // number of rings real w; pair origin; pen[] clrA={deepgreen,deepblue}; pen[] clrB={white,lightyellow,palered}; guide qring; real Rscaled(int); real rscaled(int); real eps; void drawHalf(int i,real Rt,real rt, pair p,real phi){ qring=rotate(phi)*(arc((0,0),Rt,-eps,90+eps)–reverse(arc((0,0),rt,-eps,90+eps))–cycle); radialshade(shift(p)*qring ,clrA[i%clrA.length],… Continue Reading →

Plot a function in integral form

\documentclass{article} \usepackage[inline]{asymptote} \usepackage{lmodern} \begin{document} \begin{asy} size(300,200,IgnoreAspect); import graph; real F(real t){return 4/sqrt(1+t^4);} real f(real x){return simpson(F,x,2x);} pen axPen=darkblue; pen fPen=red+1bp; draw(graph(f,-7,7,n=200),fPen); string noZero(real x) {return (x==0)?””:string(x);} defaultpen(fontsize(10pt)); xaxis(axPen,LeftTicks(noZero,Step=2)); yaxis(axPen,RightTicks(noZero,Step=0.5)); label(“$f:x\mapsto \displaystyle\int_x^{2x}” +”\frac{4}{\sqrt{1+t^4}}\, \textrm{d}t$” ,(1.7,f(1.7)),NE); \end{asy} \end{document} Source: TeX.SE Author: g.kov… Continue Reading →

Blurred curve

\documentclass[border=10pt]{standalone} \usepackage{textgreek} \usepackage[inline]{asymptote} \usepackage{lmodern} \begin{document} \begin{asy} size(200); import graph; pair[] botP={(0,0.09),(0.252,0.196),(0.383,0.429),(0.479,0.588), (0.574,0.668),(0.733,0.726),(0.883,0.747),(1,0.747),}; pair[] topP={(0,0.341),(0.252,0.451),(0.383,0.677),(0.479,0.841), (0.574,0.92),(0.733,0.977),(0.883,0.993),(1,1),}; pair[] midP=0.5*(topP+botP); guide gtop=graph(topP,operator..); guide gbot=graph(botP,operator..); guide gmid=graph(midP,operator..); real f(real x){ real t=times(gmid,x)[0]; return point(gmid,t).y; }; real s(real x){ real tt=times(gtop,x)[0]; real tb=times(gbot,x)[0]; return point(gtop,tt).y-point(gbot,tb).y;… Continue Reading →

Quarter sessile drop

\documentclass[border=10pt]{standalone} \usepackage{asymptote} \begin{document} \begin{asy}[width=\the\linewidth,inline=true] settings.outformat=”pdf”; settings.render=0; settings.prc=false; import three; import solids; unitsize(1cm); currentprojection = orthographic(5,4,2); path3 x = (-1,0,0)–(4.5,0,0); draw(x,EndArrow3); label(“$x$”,(4.7,0,0)); path3 y = (0,-1,0)–(0,4.5,0); draw(y,EndArrow3); label(“$y$”,(0,4.7,0)); path3 z = (0,0,-1)–(0,0,4.5); draw(z,EndArrow3); label(“$z$”,(0,0,4.7)); label(“$O$”,(0,-0.3,-0.5)); path3 a = arc(O,3,0,0,90,0); draw(a); revolution… Continue Reading →

Parametrised surface

\documentclass[border=10pt]{standalone} \usepackage{asymptote} \begin{document} \begin{asy}[inline=true] import graph3; real w=9cm, h=1.618w; size(w,h); currentprojection=orthographic(camera=(-13,-8.6,59),up=Z,target=(0.5,0.5,3),zoom=1); import fontsize; defaultpen(fontsize(9pt)); texpreamble(“\usepackage{siunitx}\usepackage{lmodern}”); pen linePen=darkblue+0.9bp; pen grayPen=gray(0.3)+0.8bp; pen dashPen=gray(0.3)+0.8bp+linetype(new real[] {5,5}); pen patchFillPen=paleblue; pen planeFillPen=deepgreen+opacity(0.3); triple[][] p={ // Bicubic Bezier patch control points {(1 ,0.3,0),(1 ,0.5,-1),(1 ,0.6,1),(1 ,1,0),},… Continue Reading →

Spiral cone

\documentclass[border=10pt]{standalone} \usepackage[inline]{asymptote} \begin{document} \begin{asy} settings.render = 0; settings.prc = false; import graph3; real unit = 0.1cm; unitsize(unit); defaultpen(fontsize(10pt)); triple eyeDirection = dir((-2,-2,0.7)); currentprojection = orthographic(eyeDirection); triple translateDirection = dir(cross(Z, eyeDirection)); void drawBehind(path3 thepath, pen pen=currentpen, real backOpacity = 1.0, real… Continue Reading →

Moving contact line

\documentclass[border=10pt]{standalone} \usepackage{asymptote} \begin{document} \begin{asy}[width=\the\linewidth,inline=true] unitsize(1cm); path a = (1,2.4)–(4,0.6)..(4.5,1)..(4.1,1.9)..(3.9,2)..cycle; draw(a); fill(a,cyan); path b = (0,3)–(5,0); draw(b,linewidth(2)); path c = shift(4,0.6)*scale(0.6)*unitcircle; draw(c,red+dashed); path d = (5,1.2)–(6,1.8); draw(d,EndArrow); path e = shift(8,3)*scale(2)*unitcircle; draw(e,red+dashed); path f = (9.4,1.6)–(6.1,3.58); draw(f,linewidth(2)); path g = (8,2.44)..(8.8,3.2)..(8.6,3.8)..(8.4,4.1);… Continue Reading →

The Periodic Table of the Elements

The periodic table is a huge chart that organizes all known chemical elements by their atomic number and other properties. It makes it easy to see their relationships by grouping similar ones together. This table is essential for chemists and… Continue Reading →

Drawing in Spherical Coordinates

\documentclass[border=10pt]{standalone} \usepackage{lmodern} \usepackage{upgreek} \usepackage[inline]{asymptote} \begin{document} \begin{asy}[width=\the\linewidth,inline=true] settings.outformat=”pdf”; settings.render=0; settings.prc=false; import three; import graph3; import grid3; currentprojection=obliqueX; //Draw Axes pen thickblack = black+0.75; real axislength = 1.0; draw(L=Label(“$x$”, position=Relative(1.1), align=SW), O–axislength*X,thickblack, Arrow3); draw(L=Label(“$y$”, position=Relative(1.1), align=E), O–axislength*Y,thickblack, Arrow3); draw(L=Label(“$z$”, position=Relative(1.1), align=N), O–axislength*Z,thickblack,… Continue Reading →

Word clouds

While a word cloud is a pretty picture made of words, it’s a tool that can visualize the importance of topics or keywords, or how often a word appears in a text. Bigger words indicate higher frequency. Word clouds can… Continue Reading →

Crystal structure

\documentclass[border=10pt]{standalone} \usepackage{asymptote} \begin{document} \begin{asy}[width=\the\linewidth,inline=true] settings.outformat=”pdf”; settings.render=0; settings.prc=false; size(300); import solids; currentprojection=orthographic ( camera=(8,5,4), up=(0,0,1), target=(2,2,2), zoom=0.5 ); // save predefined 2D orientation vectors pair NN=N; pair SS=S; pair EE=E; pair WW=W; //%points on cube triple A = (0,0,0); triple B… Continue Reading →

Diagram with Gradients

\documentclass[border=10pt]{standalone} \usepackage{lmodern} \usepackage{upgreek} \usepackage[inline]{asymptote} \begin{document} \begin{asy}[width=\the\linewidth,inline=true] import graph; import roundedpath; import math; //texpreamble(“\usepackage{upgreek}”); defaultpen(fontsize(10pt)); real sc=2; unitsize(sc*1bp); // 1. bounding ellipse guide ell=(150,60)..(75,120)..(3.4,60)..(75,0)..cycle; // 2. day pen penA=rgb(0.773,0.831,0.882); pen penB=rgb(0.09,0.09,0.09); pair a=(70,60); pair b=(100,60); fill(box((0,0),(90,120)),penA); axialshade(box((0,0),(100,120)),penA,a, extenda=false,penB,b, extendb=false); // night… Continue Reading →

Poster with TikZ

We know for example informational or scientific posters seen at conferences or at walls in universities or institutes. They mostly have certain characteristics in common: They have a large size, such as A2, A1 or even A0. People may look… Continue Reading →

Plotting in three dimensions

Functions with two arguments can be visualized in three-dimensional plots. Getting this on paper or into a PDF, is a bit more challenging. We need a projection, a view point, or angle, there’s a depth which means parts should be… Continue Reading →

Releux triangle

A well-known classic field of mathematics is geometry. You may know Euclidean geometry from school, with constructions by compass and ruler. Math teachers may be very interested in drawing geometry constructions and explanations. Underlying constructions can help us with general… Continue Reading →

Timeline

Using basic TikZ function it’s not too hard to create a line, add some ticks and date values and annotations. This example shows another colorful predesigned way using the timeline library. Until the timelime library becomes official part of TikZ… Continue Reading →

Mindmap

A mind map visualizes information or ideas. Usually, there’s a main concept in the center and major concepts branching outward from it. Smaller ideas start from the major concepts. So, a mind map can look like a spider web. Here,… Continue Reading →

Flowchart

A flowchart showing how we may choose a math environment. It shows using styles, placing nodes in a matrix, and drawing arrows using loops. Full explanation in Chapter 9, Creating Graphics: Constructing a flowchart. Edit and compile if you like:… Continue Reading →

Decision tree

A horizontal tree, growing to the right. I created a basic style for tree nodes, and derived styles for specific kinds of nodes. Full explanation in Chapter 9, Creating Graphics: Growing a tree. Edit and compile if you like: %… Continue Reading →

Newer posts »

© 2026 TeX.social