First, there is a description in the Art of Problem Solving Wiki, Asymptote: Advanced Configuration – Using Asymptote in LaTeX (also linked in the question regarding portable use), we can partly adapt, but in one point I want to strongly discourage you following this: Instead you should install the
sty files in a local texmf tree, about the reasons you can read in Purpose of local texmf trees.
This will be successful (WinEdt users read Harish Kumar’s answer first, please):
Download Asymptote from http://sourceforge.net/projects/asymptote/files/ and install, where you want. I will use here
The binary in TeX Live is newly built from sources, has some dependencies of other TeX Live binaries and find its
asy scripts with the builtin
kpsewhich mechanism. Hence in difference to How to use Xindy with MiKTeX? the installation from TeX Live files is not recommended.
If not already done Create a local texmf tree in MiKTeX.
Create a subfolder
<localtexmf>\tex\latex\asymptote and copy the three
sty files from the Asymptote main directory in it.
Create an empty file in
<localtexmf>\bin\ with the name
asymptote.bat (or with extension
Copy the following, paste it into the batch file and adjust the path according to your setting:
SET AsyPATH=C:\Program Files\Asymptote
This will also ensure, that the Asymptote binary finds the preshipped script files. A remark: When you save the file in Notepad or Wordpad, make sure, that there is no automatic appending of TXT extension – save the file name with double quotes:
Refresh the file name database (FNDB). BTW I assume here, that you followed the instructions and added
<localtexmf>\bin to the system path. Actually the batch script could be put elsewhere, as long as it was in the system path.
Asymptote needs also Ghostscript. You have 3 specific opportunities to make it known (adjust path, of course):
- Directly adding the command line option
Adding the environment variable
(Note, that this did actually not work in my computer, but I didn’t restart.)
The preferred variant for frequent users: Create a file
config.asy in Asymptote’s main directory with following content
Now you can execute Asymptote in your actual work folder. Let’s make a test: Copy the file
latexusage.tex from Asymptote’s
examples subfolder into a test folder, I will use
c:\test here. Open the Command Prompt and execute
cd /d c:\test,
/d switch ensures, that you can also change in one step to another drive.
Then compile with your TeX editor or execute
This will create 3
asy script files. These 3 files must now be executed with
(you could also omit the file extension) and so on for the others.
Then again compile with your TeX editor or execute
The result must look as shown below (I cropped it a bit). In Adobe Reader the interactive example works fine as well.