Forward/Inverse searching in Latex

We can use SyncTeX to achieve Forward & Inverse searching between PDF and Tex files.

latex-project

Set

pdflatex = "pdflatex --synctex=-1 %O %S";

Or compile tex file by using

pdflatex --syntex=-1 file.tex

--syntex=-1 works well for both Gvim and WinEdt.

-syntec=1 just works for WindEdt.

1. swift between Gvim and SumatraPDF

Here use vim/gvim to edit tex files and SumatraPDF for PDF files

Forward research: tex -> pdf

In vim’s command mode, type \ls . Note: Need vim plugin latex-suite.

Inverse research: pdf -> tex

Just double-left click. Note: configure setting:

"C:\Program Files (x86)\Vim\vim80\gvim.exe" --remote-silent +"%l|exe 'normal! zv'" %f

Or

"C:\Program Files (x86)\Vim\vim80\gvim.exe" --servername GVIM --remote-silent +%l %f

If you have add gvim path into $PATH, just set it as

gvim --remote-silent +"%l|exe 'normal! zv'" %f

configure setting in SumatraPDF

2. swift between WinEdt and SumatraPDF

Forward research: tex -> pdf

Use shortcut key: Shift + F8, or click shortcut key SyncTeX setting

Inverse research: pdf -> tex

Just double-left click. Note: configure setting:

"C:\Program Files\WinEdt Team\WinEdt 10\WinEdt.exe" -C="WinEdt 10.2" "[Open(|%f|);SelPar(%l,8);]"

configure setting in SumatraPDF

Reference

  1. vim: open fold with remote-silent
  2. Vim-latex: forward and reverse search
  3. Use Sumatra as a pre-viewer for LaTeX editors
  4. Using Latexmk
  5. Inverse Searching (documentation/latex-suite)