I'm trying to make LaTeX files using custom Asymptote packages, in particular olympiad.asy, and I'm wondering if there's a way I can store all of these custom packages in one spot. Right now I'm putting the olympiad.asy file into the same directory as the LaTeX file I'm compiling, and this works nicely, but I'd rather not have to include olympiad.asy in the directory every single time I want to use it. Is there a way I can make TeXWorks look in different directories for asymptote packages?

  • An ad hoc fix would be to have a soft link to the file you want to include. This way you would have them in a tar ball if you ever give the files to someone else. – user121799 Mar 27 '18 at 2:38

According to the documentation of Asymptote (section 2.5 Search path in the file asymptote.pdf), supplementary Asymptote modules are searched in this order here:

  • the current directory of the .asy or .tex file to compiling

  • in directory listed in ASYMPTOTE_DIR environment variable

  • in directory listed in ASYMPTOTE_HOME environment variable

  • in Asymptote directory created on its installation

More details (differences between UNIX and MSDOS) in the .pdf cited above.

For example, on my OS X (aka UNIX) installation, I have made this in Terminal (to avoid using the hidden directory .asy in the user home directory) :

Go to the root of the current user (if necessary):

cd ~

Open the (invisible) file .bash_profile with nano utility:

nano .bash_profile

Adding this line:

export ASYMPTOTE_HOME=/Users/my_name/Library/ASY

Save with ctrl+O, confirm file name with ENTER key, then exit with ctrl+X.

Open new Terminal window (or restart Terminal) and verify your change with echo $ASYMPTOTE_HOME or with printenv.

With this, I add Asymptote modules in /Users/my_name/Library/ASY instead the hidden /Users/my_name/.asy/ directory.

| improve this answer | |

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.