2

I have the following code:

\documentclass{standalone}
\usepackage{asymptote}
\begin{document}
\begin{asy}
size(100);
import graph;
path bill = Circle((0,0),100);
real phi = 70*pi/180;
draw(bill);
pair s = (-100,0), db, dt = exp(I*phi), e = s+300*dt;
path traj = s--e;
real [] c;
for(int i=0; i<8; ++i) {
c = intersect(bill, traj);
e = point(traj, c[1]);
db = dir(bill, c[0]);
draw(s--e,blue);
dt = -dt + 2*dot(dt,db)*db;
s = e;
e = s+300*dt;
traj = (s+dt)--e;
}
\end{asy}
\end{document}

Output is ok, except by an unwanted left margin in the picture. How can I remove it?

1

You only need to add varwidth to the options of standalone.

\documentclass[varwidth]{standalone}
\usepackage{asymptote}
\begin{document}
\begin{asy}
size(100);
import graph;
path bill = Circle((0,0),100);
real phi = 70*pi/180;
draw(bill);
pair s = (-100,0), db, dt = exp(I*phi), e = s+300*dt;
path traj = s--e;
real [] c;
for(int i=0; i<8; ++i) {
c = intersect(bill, traj);
e = point(traj, c[1]);
db = dir(bill, c[0]);
draw(s--e,blue);
dt = -dt + 2*dot(dt,db)*db;
s = e;
e = s+300*dt;
traj = (s+dt)--e;
}
\end{asy}
\end{document}

enter image description here

  • Thanks, it worked. – Rodrigo Mar 8 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.