Recently I have installed vim-latex
plugin in gVim
. I use portable MiKTeX
to compile tex
document into pdf
documents. Till now, I have used command prompt to compile the tex files. After installing vim-latex
plugin I found that there's a compile option under Tex-Suite>Compile
menu. But clicking it doesn't do anything. So how can I configure vim-latex to use the portable MiKTeX compiler?
Initial googling let me to this link: http://vim-latex.sourceforge.net/documentation/latex-suite/customizing-compiling.html#Tex_CompileRule_format. However, I couldn't find any clue to where actually configure this variables. But finally I found the location. For my case it was
C:\Program Files (x86)\Vim\vimfiles\ftplugin\latex-suite\texrc
The texrc file has all the variables described in the link. As I said in my question, I use miktex portable
so first I needed to change the compiler. So I searched for g:Tex_CompileRule_pdf
in the file and found this line
TexLet g:Tex_CompileRule_pdf = 'pdflatex -interaction=nonstopmode $*'
So, I just replaced pdflatex
with the full path
TexLet g:Tex_CompileRule_pdf = 'E:\full\path\of\miktex\pdflatex -interaction=nonstopmode $*'
Next thing that needed to be changed is telling vim-latex to use pdflatex
to compile by default. So, I searched for the g:Tex_DefaultTargetFormat
variable in the file and found this line
if has('macunix')
TexLet g:Tex_DefaultTargetFormat = 'pdf'
else
TexLet g:Tex_DefaultTargetFormat = 'dvi'
endif
No need to keep all this checking. so I commented out most of the lines
"if has('macunix')
TexLet g:Tex_DefaultTargetFormat = 'pdf'
"else
" TexLet g:Tex_DefaultTargetFormat = 'dvi'
"endif
After this, vim-latex was able to compile my files. But the viewer wasn't working. So, needed to make a little more change. Searched for g:Tex_ViewRule_ps
and changed the lines under if has('win32')
to look like this.
if has('win32')
TexLet g:Tex_ViewRule_ps = 'gsview32'
TexLet g:Tex_ViewRule_pdf = 'E:\Share\PortableApps\SumatraPDF-2.4\SumatraPDF.exe'
TexLet g:Tex_ViewRule_dvi = 'yap -1'
I had to use SumatraPDF
because for some reason Adobe Reader 11
was giving the error Unable to find the file
. But Sumatra
in not so bad. Now I can use vim-latex in peace :)