I want a PDF document ultimately, but I'm setting my default target format to dvi in order to use the YAP dvi viewer as the default (the PDF viewer can't do forward searches on my Windows machine, I believe due to spaces in file/directory names.) As a result, only the dvi file is updated when I compile. How can I compile to both dvi and pdf every time I compile? g:Tex_MultipleCompileFormats appears to be for something quite different.

  • You could use one of the available multi-step helpers to do it e.g. arara or mklatex or whatever. (Or you could get a more intelligent PDF viewer although spaces in file/directory names are Trouble anyway and should be avoided.) – cfr Nov 30 '14 at 0:46
  • @cfr Well, I was using Sumatra PDF, and it's supposed to be pretty smart. I don't know for sure that the issue is the spaces, but I struggled with it all afternoon and am just happy that YAP works. – bongbang Nov 30 '14 at 0:58
  • Just this certainly should work no problem with PDF. (I use this in Okular with pdfLaTeX, for example.) – cfr Nov 30 '14 at 1:17
  • @cfr It should. I started a new question about precisely that if you want to try to crack it: tex.stackexchange.com/questions/214643/…. Thanks. – bongbang Nov 30 '14 at 6:44

The g:Tex_FormatDependency_<FORMAT> variable in vim-latex can be used to call multiple different formats (through their respective g:Tex_CompileRule) when <FORMAT> is compiled.

If compiling to a pdf say, setting let g:Tex_FormatDependency_pdf='dvi,ps,pdf' will cause vim-latex to compile by running whatever is stored in g:Tex_CompileRule_dvi, g:Tex_CompileRule_ps, and finally g:Tex_CompileRule_pdf. This could have it compile in one format and just convert between the others (as is the intended use of this) or it can be used to compile the same in a number of different ways.

To avoid messing around with the standard pdf compilation you can alternatively define

let g:Tex_DefaultTargetFormat='mlt'
let g:Tex_FormatDependency_mlt='dvi,ps,pdf'

This way toggling between mlt (or any random format) and pdf allows compilation of all formats only when necessary.

It may still be necessary to consider g:Tex_MultipleCompileFormats insofar as if multiple runs are needed (i.e. for bibtex), then if g:Tex_MultipleCompileFormats does not include all (or none) of the simultaneously compiled formats then the different formats will fall out of sync with one another.

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.