William Blum's website

PDF-Latex synchronization (continued)

This is the dual of the previous post: I have now implemented forward-search in SumatraPDF, i.e. the ability to go from the source .tex file to the corresponding location in the PDF. The communication between the TeX editor and SumatraPDF relies on the DDE protocol. (Most TeX editors such as WinEdt and TeXnicCenter support it.)


If you want to give it a try, the updated binary can be downloaded here.

Configuring with WinEdt

For WinEdt, I have created a macro file to do all the stuff automatically. To install it, proceed as follows:

1- Download the macro file Sumatra-Find.edt. 2- Save it in the folder: C:\Program Files\WinEdt Team\WinEdt\Exec\ 3- Edit the file: goto line 22 and replace the string 'd:\Tools\SumatraPDF-sync.exe' by the path to your local copy of Sumatra. 4- Go to the menu 'Option\Menu setup'. Create a new macro menu somewhere (under 'Accessories' for instance) and fill the options as follows: Name: Sumatra Find Macro: Exe('%b\Exec\Sumatra-Find.edt'); Requires File Filter: %P\%N.pdf Start in: %P Shortcut: F8

That's it! Now you can just press F8 anywhere in your .tex sources files and it will automatically locate the corresponding position in the PDF.

Configuring with TeXnicCenter

To setup forward-search with TeXnicCenter proceed as follows: 1- Menu 'Build\Define output profiles...' 2- Select the profile "Latex=>PDF" 3- Select the tab 'Viewer' 4- Fill the options as follows: Path of executable: c:\tools\SumatraPDF-sync.exe Forward search: select DDE command Command: [ForwardSearch("%bm.pdf","%nc",%l,0)] server: SUMATRA topic: control

Configuring with ntEmacs

1- Download the script file sumatra-forward.el and load it from your init.el file. 2- Make sure that you have the ddeclient tools. (It is bundled with ntemacs) 3- Press F8 in the TeX document to trigger a forward-search

Alternative instructions to setup Emacs with SumatraPDF can be found on Titus Barik's blog

Synchronization in action


Enjoy! And feel free to post a comment to let me know how it works for you.

Updated on 21 May 2008 (added emacs script file)