Help for a problem about asymptote picture size

I used xelatex and the asymptote package for the asy pictures inside the tex file, which both worked just fine. But when I install the Miktex and asymptote on my new computer (the OS is the same as the old one), I find the asy picture would turn out to be on a full size of A4paper instead of a small picture which just contain its content as it should be whenever I put a label in that asy picture.

What can I do to fix this? Many thanks.

• probably this issue: github.com/vectorgraphics/asymptote/issues/… – David Carlisle Aug 6 '16 at 14:20
• if it is the above add texpreamble("\usepackage[nosetpagesize]{color,graphicx}"); to your .asy file. – David Carlisle Aug 6 '16 at 14:32
• At least for now and assuming you are using the latest versions of graphcix: If you don't have an asydef environment in your source document add \begin{asydef} texpreamble("\usepackage[nosetpagesize]{color,graphicx}"); \end{asydef} to your source document after the \begin{document} command. If you already are using that environment in your document add the line suggested by David Carlisle to that environment. – Herb Schulz Aug 6 '16 at 15:34
• @HerbSchulz can you answer (I don't really know asymptote syntax) – David Carlisle Aug 6 '16 at 22:21
• Thank you all for the help! texpreamble("\usepackage[nosetpagesize]{color,graphicx}"); really works! – AvadaKedavra Aug 10 '16 at 23:47

At least for now and assuming you are using the latest versions of the graphicx package: Place an asydef environment just after the \begin{document} environment starts in your source document that looks like this:

\begin{asydef}
texpreamble("\usepackage[nosetpagesize]{color,graphicx}");
\end{asydef}


If you already are using that environment in your document add the line shown to the environment. All of your asymptote figures will be properly cropped.

At some point this will all go away and you can remove that line/environment.

NOTE: As of an update to the asymptote package on or around (the CTAN repositories take a shile to synchronize) 2016/08/28 the problem has been fixed and you should no longer need this temporary fix.

• This completely solved my problem, many thanks! – AvadaKedavra Aug 10 '16 at 23:46
• PLEASE SEE THE NOTE: IN THE ANSWER ABOVE. – Herb Schulz Aug 28 '16 at 12:47