William Blum's website

# Synchronizing PDF files with Latex documents

I am currently in the process of writing up my PhD thesis using Latex. I just realized how spoiled Mac users are when it comes to TeX tool support: nearly all Tex editors support viewing PDF files with source synchronization ( iTeXMac2, TextMate,

TeXniscope, TeXShop, PDFViewer). On the windows platform, until recently, not a single PDF viewer was capable of doing that including Acrobat, PDF-XChange Viewer, Foxit reader, and SumatraPDF.

Of course under the Windows platform we have the Yap DVI viewer that comes with the MikTeX distribution. Ah, Yap,... This crappy piece of software that becomes less and less usable as the version increases: poor responsiveness when browsing the document, no pre-caching of the images, polling the .dvi file thousands times a millisecond to check whether its content has changed instead of using the proper Windows API, blocking of the .dvi file preventing latex from compiling, and last but not least: loads of modal error messages forcing you to switch to the mouse to get rid of them when you just want to be typing your latex document.

A quick browsing journey on the web suggested me that I was not the only person to feel that frustrated about the current TeX viewing facilities on Windows. But since no one seemed to be interested in implementing the desired features, I decided to give it a try.

So here we are: I have proposed several patches for SumatraPDF that were accepted by the author: the first one implements autorefresh: when you recompile your tex document to pdf, the viewer automatically refreshes itself without any need for user interaction.

The second feature is inverse-search synchronization based on pdfsync: when you double-click on the pdf file it brings you directly to the .tex source file corresponding to that location in the pdf. By default the WinEdt editor is invoked. This can be configured (Menu 'File\set inverse search command line'). For instance the string to start TeXnicCenter is

"C:\Program Files\TeXnicCenter\TEXCNTR.EXE" /ddecmd "[goto('%f', '%l')]"


For WinEdt it is:

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


I have also updated LatexDaemon to make it compatible with pdfsync.

If you want to give it a try, you can download the binary file here. The changes to the source code have been submitted to the SVN repository at Google Code.