我有以下代码:
\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}
输出正常,除了图片中多余的左边距。我该如何去除它?
答案1
您只需添加varwidth
到 的选项中即可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}