Re: [Vim-latex-devel] Viewing pdf
Brought to you by:
srinathava,
tmaas
From: Mario D <eg...@gm...> - 2016-03-07 18:26:50
|
More or less I have solved the problem I asked about: the solution is as follows (from my tex.vim): --------------------------------------------------------- function! Set_PDF() let g:Tex_CompileRule_pdf = 'pdflatex --synctex=1 -interaction=nonstopmode -file-line-error-style $*' let g:Tex_ViewRule_pdf = 'okular --unique 2>/dev/null 1>&2 ' let g:Tex_DefaultTargetFormat = 'pdf' exec 'TTarget '.g:Tex_DefaultTargetFormat endfunction function! Set_LaTeX() let g:Tex_CompileRule_dvi = 'latex -src-specials -interaction=nonstopmode -file-line-error-style $*' let g:Tex_ViewRule_dvi = 'xdvi 2>/dev/null 1>&2 ' let g:Tex_DefaultTargetFormat = 'dvi' exec 'TTarget '.g:Tex_DefaultTargetFormat endfunction noremap <leader>latex :call Set_LaTeX() noremap <leader>pdf :call Set_PDF() if getline(1) =~ "PDFLaTeX" | :call Set_PDF() | endif ------------------------------------------------------------- Now, from within a file I am able to switch pdf/latex compilation and correct visualization. The only thing that I can not fix is the following: I would like to have the file recognized upon opening. For this, if a file is meant to be pdflatex it has the first line equal to %PDFLaTeX so that it should trigger the "if getline..." in tex.vim The problem is that when I open such file I get the following error: "file.tex" 194L, 5881C Error detected while processing function Set_PDF: line 4: E492: Not an editor command: TTarget pdf How do I fix this? TIA 2016-02-23 9:21 GMT+01:00 Mario D <eg...@gm...>: > In my ~/.vim/ftplugin/tex.vim I defined the following: > > function! Set_PDF() > let g:Tex_DefaultTargetFormat = 'pdf' > let g:Tex_CompileRule_pdf = 'pdflatex --synctex=1 > -interaction=nonstopmode -file-line-error-style $*' > let g:Tex_CompileRule_dvi = 'pdflatex --synctex=1 > -interaction=nonstopmode -file-line-error-style $*' > let g:Tex_ViewRule_pdf = 'okular --unique 2>/dev/null 1>&2 ' > let g:Tex_ViewRule_dvi = 'okular --unique 2>/dev/null 1>&2 ' > let g:Tex_MultipleCompileFormats = '' > endfunction > > function! Set_LaTeX() > let g:Tex_DefaultTargetFormat = 'dvi' > let g:Tex_CompileRule_dvi = 'latex -src-specials > -interaction=nonstopmode -file-line-error-style $*' > let g:Tex_ViewRule_dvi = 'xdvi 2>/dev/null 1>&2 ' > let g:Tex_MultipleCompileFormats = '' > endfunction > > noremap <leader>latex :call Set_LaTeX() > noremap <leader>pdf :call Set_PDF() > > My intention is the following: if I use ,pdf (my leader is ,), then vim > should be set up to produce pdf whereas if I use ,latex then it should > produce dvi. > > Now I open a latex file which should produce pdf, I call ,pdf and I > compile using ,ll > Everything is fine. > My problem is when I try see the resulting pdf: if I use ,lv then what I > get is the dvi file displayed by xdvi whereas if I use ,ls then I get again > the dvi file but this time it is displayed by okular. > What I would like is that by either I should get displayed the pdf by > means of okular. > What am I doing wrong? > > Thanks > |