# Sublime Text 3 with LaTeXTools failed to handle tex with asymptote

I'm using sublime with Latextools addon to edit my tex files, if the tex file includes \begin{asy}\end{asy} environment, the Asymptote codes will not work with a warning,

Package asymptote Warning: file (texFileName)-1.pdf' not found on input line n.


and also produce a corresponding .asy file, like (texFileName)-1.asy, which can be compiled separately.

I think it is the mistake of latextools, unfortunately I can't modify its building files, can someone please help? this is an example code,

\documentclass{article}
\usepackage{asymptote}
\begin{document}
\begin{asy}
size(200);
filldraw((0,0)--(0,2cm)--(2cm,0)--cycle);
\end{asy}
\end{document}

• Welcome to TeX.SX! – Andrew Mar 24 '16 at 10:49

If you are not familiar with builder engine setting of LaTeXTool, please read the section of Build engine settings in ReadMe file of LaTeXTool

The default LaTeXTools builder is "traditional" that uses latemk (Texify for MiKTeX) to trigger the compile system, which is equal to run this command in your terminal

latexmk foo.tex


foo is your tex file name (the pdf file may pop up if you install and configure the pdf reader for LaTeXTools). In order to compile the asymptote graph, you need to run the command in terminal (assuming you use xelatex to compile tex file)

xelatex foo.tex
asy foo-*.asy
xelatex .tex


Currently, it seems none of the LaTeXTool builders (not even the script builder) provides the command or option that can accomplish the task of building command shown above. The main issue appears that you cannot specify the target file foo-*.asy for "builder_settings"` in user settings.

So far the only solution is possibly writing your own builder script file which is written in python (if you know how to program in python), put it in builders folder of LaTeXTools package, and change the builder in user settings file.