Wednesday, February 25, 2009

Sumatra PDF Viewer for LaTeX users on Windows

If you use LaTeX on Windows, or in particular pdflatex, you must have noticed that viewing the resulting PDF file is not as easy as you would think.

Sure, Adobe Reader displays it fine. But apart from being bloatware and slow as hell, it also locks the PDF file it is displaying. Thus you cannot rerun pdflatex until you close the file in Reader, because the output file cannot be overwritten. This is a pain in the arse.

Foxit Reader seems like a decent alternative; it is much faster and less bloated than Adobe Reader (even though the installer tries to get you hooked on several other pieces of software that you probably don't want). Foxit does not lock the currently viewed file; however, it offers no reload option, and if you overwrite the output file, it will only display blank pages for what's not currently cached.

Enter Sumatra PDF. A very lightweight and very simple program, contained in a single executable file, written by a single developer, but it has the one killer feature that LaTeX authors need. It automatically reloads the PDF file whenever it changes. And it stays on the same place in the document while it does this.

There is currently a bug that causes the window to demaximize when it reloads, but you can work around that simply by not maximizing the window in the first place. This little viewer will definitely make my life easier.

11 comments:

Eamon Nerbonne said...

Ghostview has this functionality too. It's not otherwise particularly handy, since it waits to reload until it receives focus and since it lacks many of the amenities of adobe reader, but for latex preview, it works.

Thomas ten Cate said...

Sumatra also lacks several features found in Adobe Reader. Case in point: hyperlinks. But for LaTeX preview, it works ;)

Thomas ten Cate said...

Also, I just noticed that it has a pretty bad memory leak. After a few days of continuous running, memory usage was up to 0.5 GB.

伟廉 said...

The 'demaximized on reload' bug mentioned in this post has been fixed in the latest revision. You can download it from http://william.famille-blum.org/software/sumatra/

Anonymous said...

This viewer increases my productivity exponentially, thanks for posting it.

songuke said...

Exactly what I'm looking for. I've used Foxit Reader and PDF Xchange Viewer on Windows before. Like Adobe Reader, PDF Xchange Viewer does lock the file when it is opened, so it is a pain to use with LaTeX output. SumatraPDF rocks!

id said...

Another viewer worth mentioning on windows, which many people have installed anyhow: google chrome. It views files just like webpages and doesn't lock them after loader. However, it's got limited PDF-specific functionality, and it won't auto-update if the underlying file changes.

Eamon Nerbonne said...

Hmm, unfortunate how the openid login doesn't publish your name - that last comment's me :-)

Ad Terian said...

Sumatra Pdf Reader Free Download

PDF signature said...

You just made something that I thought was so difficult be, truly, so easy! Thanks for the post!

Tech Blog said...

Thanks for sharing such a nice post.

My Website Tech Blog