# Position shift when adding label to 3D asymptote diagram

I have this strange issue with 3d asymptote diagrams. Without labels they act as a normal figure, but when I add label, the diagram moves to the edge off the page...

MWE:

\documentclass[12pt,a4paper,addpoints]{exam}

\usepackage{asymptote}

\begin{document}
\begin{figure}
\begin{asy}
import solids;
import three;

size(5cm);

currentprojection=orthographic(0,-5,3);

triple start = (0,0,1);
real length = 5;
triple ax = (0,0,1);
draw(r,black);

revolution downcone=cone(Z,1,-3);
draw (downcone,black);

draw((-1,0,7)--(1,0,7),Arrows3);

draw((1.5,0,1)--(1.5,0,6),Arrows3);

draw((1.5,0,1)--(1.5,0,-2),Arrows3);

\end{asy}
%label("2m",(0,0,7),N);
%label("5m",(1.5,0,3.5),E);
%label("3m",(1.5,0,-0.5),E)
\caption{Graansilo}
\end{figure}
\end{document}


When I add the commented label lines to the asy-environment, things start to go wrong... the diagram is no longer centered (or at least in the visible area of the page), but moves to the edge...
When trying with multiple diagrams on a page, they even appear on top of each other...
I tried altering the label-lines (adding \$, numbers only, letters only), tried changing the perspective.

still no clue...

compiling .asy gives 'illegal token "\"', but that's all i have...

-

Replace the line

\usepackage{asymptote}


\usepackage[inline]{asymptote}

-

Try this:

\documentclass[12pt,a4paper,addpoints]{exam}
\usepackage{asymptote}
\begin{document}
\begin{figure}
\centering
\begin{asy}
import settings;
settings.prc=false;
settings.render=0;
import solids;
import three;

size(5cm);

currentprojection=orthographic(0,-5,3);

triple start = (0,0,1);
real length = 5;
triple ax = (0,0,1);
draw(r,black);

revolution downcone=cone(Z,1,-3);
draw (downcone,black);

draw((-1,0,7)--(1,0,7),Arrows3);
draw((1.5,0,1)--(1.5,0,6),Arrows3);
draw((1.5,0,1)--(1.5,0,-2),Arrows3);

label("2m",(0,0,7),N);
label("5m",(1.5,0,3.5),E);
label("3m",(1.5,0,-0.5),E);

\end{asy}

\caption{Graansilo}
\end{figure}
\end{document}


Edit Changes to the OP's code:

• labels uncommented and moved inside the asy environment;
• added a ; missed at the end of the third label statement, which most probably was the reason of troubles.

• added settings to get a vector output (noprc+render=0) from 3D drawing:

import settings;

settings.prc=false;

settings.render=0;

-
Can you add pointers to the changes you made to the OP's code? –  egreg May 25 '13 at 16:26
Note that the line import settings; is redundant here. The purpose of this line is to allow you to write e.g. render=0; rather than settings.render=0;. –  Charles Staats May 26 '13 at 12:52