Go to index page
   

Configuring Vim

For the forward jump do the following:
  • Create a DVI file with jump targets
  • Start YAP and jump to a target
Put the following code in ftplugin/tex/latex.vim.
map <F5> :call CompileLatex()<cr>

function! CompileLatex()
  silent ! latex --src-specials % 
  exe "silent !start YAP.exe -1 -s " . line(".") . "%<.tex %<.DVI"
endfunction
								
Explanation:

latex --src-specials means: 
Compile latex with the source special option

The source special option means: 
Insert source specials markers in certain places 
of the DVI file. The markers are the jump targets. 

% means: Use current filename e.g. loreipsum.tex

So this will become as a command line for example: 
latex --src-specials loreipsum.tex 
creating loreipsum.dvi file

start YAP.exe means: start YAP with the loreipsum.dvi

-1 means: Single-instance (1 stands for "one instance only").
Use an already opened Yap application window (if one exists).
This flag prevents multiple Yap applications instances

-s means: Find source specials markers in the DVI file (s stands
for "search"). The syntax is: "line number" followed by 
"source file name" and "dvi file name"

%< means: Use filename without extension e.g. loreipsum
without .tex ("loreipsum.tex")

So this will become as a command line for example:
YAP.exe -1 -s 23 loreipsum.tex loreipsum.DVI 
where 23 is the line number