For some reason I can't draw two pictures onto currentpicture in Asymptote. Currently I have
\documentclass{article}
\usepackage[inline]{asymptote}
\begin{document}
\begin{asy}[width=0.7\textwidth]
import three;
string d = "$";
triple A = (0,0,0); // Vertices of a cube
triple B = (0,1,0);
triple C = (-1,1,0);
triple D = (-1,0,0);
transform3 sd = shift(0,0,-1);
triple Ap = sd * A;
triple Bp = sd * B;
triple Cp = sd * C;
triple Dp = sd * D;
void drawCube(picture pic, string[] labels) {
draw(pic,A--B--C--Cp--Bp--Ap--A--B--Bp);
draw(pic,B--C);
draw(pic,A--D--C);
draw(pic,Ap--Dp--D,dashed); // behind the cube
draw(pic,Dp--Cp,dashed);
if (labels.length > 0) {
label(pic, d + labels[0] + d, A, NW);
label(pic, d + labels[1] + d, B, N);
label(pic, d + labels[2] + d, C, NE);
label(pic, d + labels[3] + d, D, N);
label(pic, d + labels[4] + d, Ap, SW);
label(pic, d + labels[5] + d, Bp, S);
label(pic, d + labels[6] + d, Cp, SE);
label(pic, d + labels[7] + d, Dp, S);
}
}
picture start; // first picture (the one with the cube)
size(start, 100);
string[] start_labels = {"A","B","C","D","A'","B'","C'","D'"};
drawCube(start, start_labels);
picture step1; // second figure, the one with the dashed line
size(step1, 100);
triple corner1 = (0,0,0);
triple corner2 = (-1,1,-1);
draw(step1, corner1--corner2,dashed);
dot(step1, corner1);
dot(step1, corner2);
add(step1.fit(), (-2,0), N); // LINE 1
add(start.fit(), (0,0), N); // LINE 2
label("Starting position", (0,0),S);
label("Choose a pair of vertices: $2$ ways", (-2,0), S);
\end{asy}
\end{document}
If this is the file "test.tex", then the building script file is
pdflatex test.tex
asy *.asy
pdflatex test.tex
pdflatex test.tex
I'd like there to be a figure with a dashed line on the left and a cube on the right. However, when I run Asymptote on this file, I get two cubes!
I tried switching the lines labeled "LINE 1" and "LINE 2", which leads to the other picture being drawn twice instead:
Obviously this is quite frustrating. How can this be fixed?
Edit: This is compiled with pdflatex, which outputs an .asy file in the same directory, then with asy. The file is the same except for some asydef code which doesn't affect it and the following added to the beginning:
if(!settings.multipleView) settings.batchView=false;
settings.tex="pdflatex";
settings.inlinetex=true;
deletepreamble();
defaultfilename="test-1";
if(settings.render < 0) settings.render=4;
settings.outformat="";
settings.inlineimage=true;
settings.embed=true;
settings.toolbar=false;
viewportmargin=(2,2);
Also, this line is at the end:
size(241.49895pt,0,keepAspect=true);
asy
and fail to reproduce your observation. How do you compile your code?