0

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. – Charles Staats Nov 4 '15 at 1:03
  • @CharlesStaats thanks, I hadn't heard of that package, but it looks quite useful – Ed.C Nov 4 '15 at 19:35
1

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).

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.