3

Whenever I use Asymptote with Latex, each instance of the environment gets its own new file. This creates a large amount of files. Is there any way to get all of these files placed into another folder by themselves?

3

From the dtx file:

% This package produces quite a number of output files, which by default
% are created in the same directory as the \LaTeX\ document that is being
% compiled. To keep things more tidy, you can specify an output directory
% for these files by defining the \cmd\asydir\ command. For example, if you
% wish to store the figure files in the subdirectory \texttt{asytmp/}, the
% you would write \verb|\renewcommand\asydir{asytmp}|.
%
% Alternatively (and tentatively), you may write \verb|dir=asytmp| in
% either the \texttt{asy} environment options or the options to
% \cmd\asysetup.

Alternatively, from asy-latex.pdf:

This package produces quite a number of output files, which by default are created in the same directory as the LATEX document that is being compiled. To keep things more tidy, you can specify an output directory for these files by defining the \asydir command. For example, if you wish to store the figure files in the subdirectory asytmp/, the you would write \renewcommand\asydir{asytmp}.

Alternatively (and tentatively), you may write dir=asytmp in either the asy environment options or the options to \asysetup.

So far as I know this information is not found in asymptote.pdf, the main documentation for Asymptote.

  • After using this, I came upon another problem: asymptote cannot find the files in the subdirectory. For example, if I used \renewcommand\asydir{asyfiles}, and tried asy.exe asyfiles/[filename]-*.asy, it cannot find the .asy files. How would I fix this? – user111 Jun 5 '16 at 16:34
  • The most likely fix is simply to cd to asyfiles before running asy.exe. If that is unsatisfactory, I'm not sure. Since you are apparently using Windows, make sure you are using ` rather than /` to denote directory change. If that is fixed in the real comment, the error I would predict is that asy.exe successfully compiles the files, but puts the images in the document's root folder rather than in the asyfiles subfolder. If asy.exe is in fact not finding the files, I don't know what is going on. – Charles Staats Jun 6 '16 at 16:51
  • Dear Charles, How do I get the following to work? the way I wrote doesn't change the directory for me. \documentclass{article} \usepackage{asypictureB,asymptote} \asysetup{dir=tmp}%doesn't work \renewcommand\asydir{tmp}%doesn't work \begin{asyheader} \end{asyheader} \begin{document} \begin{asypicture}{} unitsize(1cm); draw((0,0)--(1,1)); \end{asypicture} \end{document} – Shuodao Nov 2 '18 at 19:39

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.