4

I'm having trouble setting up vim-latex suite to produce .pdf files. Right now the \ll (<leader>ll) command will compile latex. Then \lv (<leader>lv) will produce a .dvi file.

Is there another command to initiate the standard .tex -> .dvi -> .ps -> .pdf build sequence?

Alternatively, can I configure \lb to create .ps and .pdf files?

So far I have tried the following commands from the vim-latx documentation:

let g:Tex_FormatDependency_pdf = 'dvi,ps,pdf'
let g:Tex_CompileRule_dvi = 'latex --interaction=nonstopmode $*'
let g:Tex_CompileRule_ps = 'dvips -Ppdf -o $*.ps $*.dvi'
let g:Tex_CompileRule_pdf = 'ps2pdf $*.ps'

However, this doesn't build ps or pdf file. I can still make them manually with dvips mydoc.dvi and ps2pdf mydoc.ps.

  • 1
    Do you want to compile through the tex > dvi > ps > pdf or would compiling directly with pdflatex be of interest? Only thing that comes to mind right now is are you opening tex files as latex or plaintex? Does adding let g:tex_flavor='latex' make a difference – Dai Bowen Oct 18 '16 at 21:20
  • I slightly prefer tex > dvi >ps >pdf, but pdflatex is ok too. How can I check for latex vs plaintex? let g:tex_flavor='latex' and let g:tex_flavor='latex' don't have any effect; either way, only the .dvi file is generated. – ichbinallen Oct 18 '16 at 21:53
  • 2
    I find vim-latex-suite just too complicated. All you need to produce a pdf is to type :!pdflatex %, and then when you've done that once, :!<up-arrow> will let you do it again... – Thruston Oct 18 '16 at 21:56
  • Thanks @Thruston. I took your advice and removed vim-latex. I added map <Leader>ll :!pdflatex %:p to my vimrc. Now \ll builds the latex file. – ichbinallen Oct 20 '16 at 1:03
3

I would guess that you had g:Tex_DefaultTargetFormat set to its default value of dvi (at least for Windows/Unix according to the documentation).

With g:Tex_DefaultTargetFormat set to dvi, compilation will follow the chain set by g:Tex_FormatDependency_dvi rather than g:Tex_FormatDependency_pdf which by default will only lead to g:Tex_CompileRule_dvi being executed.

In order to get the dvi -> ps -> pdf chain working, you would need

  • let g:Tex_FormatDependency_dvi = 'dvi,ps,pdf' rather than let g:Tex_FormatDependency_pdf = 'dvi,ps,pdf' so that when Vim-LaTeX tries to build a dvi file (as it defaults to), it follows the dvi -> ps -> pdf chain.

or

  • g:Tex_DefaultTargetFormat='pdf' rather than g:Tex_DefaultTargetFormat='dvi' so it follows the g:Tex_FormatDependency_pdf which you defined in the question to perform the dvi -> ps -> pdf chain.

For running pdflatex you should be able to just use g:Tex_DefaultTargetFormat='pdf' with g:Tex_CompileRule_pdf and g:Tex_FormatDependency_pdf left to their defaults.

0

If your latex project contains multiple source files, then set g:Tex_DefaultTargetFormat = 'pdf' doesn't help. In this case, you need to set g:Tex_MultipleCompileFormats = 'pdf' then the pdf file will be generated when you type \ll. So, just add

  • let g:Tex_MultipleCompileFormats = 'pdf'
  • let g:Tex_DefaultTargetFormat = 'pdf'
    to your ~/.vimrc file, the problem should be solved.
  • 1
    This description of the use of g:Tex_MultipleCompileFormats doesn't seem to agree with my reading of the documentation (vim-latex.sourceforge.net/documentation/latex-suite/…). – Dai Bowen Nov 1 '17 at 20:27
  • Hi, @DaiBowen . I read the documentation. It does seem that I misunderstood the meaning of g:Tex_MultipleCompileFormats. But I did a little experiment with it. It seems that only when I set both the g:Tex_MultipleCompileFormats and g:Tex_DefaultTargetFormat to pdf my latex-suite generates a pdf file. Lacking either of these two variables fails. And I have a latex project with multiple files. – liukairen Nov 3 '17 at 18:25
  • g:Tex_DefaultTargetFormat is indeed important to getting the right compilation route, but g:Tex_MultipleCompileFormats shouldn't prohibit compilation (but if it doesn't include whatever g:Tex_DefaultTargetFormat is set to then \ll will only trigger a single run of (pdf)latex rather than repeated). Imo if you can reproducibly not compile with g:Tex_MultipleCompileFormats set to empty there's a bug to be reported, I'd hazard that it's unlikely though. – Dai Bowen Nov 3 '17 at 18:36

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.