# How to set up latex-suite to compile asymptote in tex files?

I am using vim with latex-suite to compile to pdf.

With the following in filename.tex:

\usepackage{asymptote}
...
\begin{asy}
...
\end{asy}
...


The file filename-1.asy is produced (and the log warns that filename-1.tex could not be found), but I can't work out how to add a compiler rule to latex-suite to also compile anything in the working directory matching filename-*.asy with asymptote.

Does anyone know how to set it up to also compile asymptote files automatically with \ll ?

# Update

As in Marijn's answer, Tex_CompileRule_ is what I was missing.

Here is a full MWE as requested:

test.tex:

\documentclass{article}
\usepackage{asymptote}
\begin{document}
\begin{asy}
settings.outformat = "pdf";
label("Hello world!");
\end{asy}
\end{document}


~/.vim/ftplugin/tex.vim:

let g:Tex_DefaultTargetFormat = 'pdf'
let g:Tex_MultipleCompileFormats='pdf, aux'
let g:Tex_CompileRule_asy = 'asy %:r-*.asy'
let g:Tex_FormatDependency_pdf = 'asy,pdf'

• I'm not familiar with latex-suite, but if you're open to enabling shell-escape, you might check out the asypictureB package. Nov 4, 2015 at 1:03
• @CharlesStaats thanks, I hadn't heard of that package, but it looks quite useful
– Ed.C
Nov 4, 2015 at 19:35

You need to add a compile rule and a dependency to ~/.vim/ftplugin/tex.vim (assuming Linux). This file may not exist, in which case you should create it. Any other configuration file that latex-suite can find may also work. Add the following:

let g:Tex_CompileRule_asy = 'asy %:r-*.asy'
let g:Tex_FormatDependency_pdf = 'asy,pdf'


Optionally, you can add some rules to facilitate processing:

let g:Tex_DefaultTargetFormat = 'pdf'
let g:Tex_ViewRule_asy = 'evince -1'
let g:Tex_MultipleCompileFormats = 'pdf'


Then in vim you can compile the following MWE:

\documentclass{article}
\usepackage{asymptote}
\begin{document}
\begin{asy}
settings.outformat = "pdf";
label("Hello world!");
\end{asy}
\end{document}


Possibly you have to press \ll twice because latex-suite does not understand that Asymptote requires recompilation.

Also: please update your MWE to make it compile (replace / with \ as a start).