33

I am using latexmk on a Red Hat 5 machine. I use it as:

latexmk -pdf -pvc

I would like to have my PDF reader automatically update the PDF as it is changed. What PDF reader do I need for this? What settings should I use?

14

You can get automatic updating with xpdf by setting the following in ~/.latexmkrc:

$pdf_previewer = "start xpdf -remote %R %O %S";
$pdf_update_method = 4;
$pdf_update_command = "xpdf -remote %R -reload";

These settings are straight out of the latexmk documentation. I've found this works very well, and is my preferred solution at the moment. It has the advantage that xpdf doesn't update its screen until told to do so by latexmk, which is after it has finished making the pdf file.

(I used to use gv -watch, but, particularly with big files, gv regularly tried to do a screen update before the viewed file was completely made, which resulted in a mess.)

59

Evince and Okular will auto-reload when the file being viewed changes. So does another option: Zathura.

That said, my recommendation would still be MuPDF instead, though it'll take some more work to set up. The reason is that MuPDF in general is a much faster program, and will reload faster. It doesn't auto reload like these do, but this can be solved.

I don't use latexmk personally, but if memory serves, there's a way of make it call a certain command at the end of a successful command. You can set it up to send MuPDF the SIGHUP signal, which refreshes it. I did something similar for a vim live latex plugin I wrote years ago, which I abandoned. However, it was forked and exists here on GitHub.

Here's it is in action:

enter image description here

(EDIT: I don't use this anymore, so I changed the links above to a clone of it made by someone else on GitHub.)

  • 2
    Another good suggestion. I'm intrigued by your LaTeX/Vim integration. I'll give it a try. – jlconlin Sep 19 '11 at 22:06
  • 2
    The link to your plugin seems to be dead :-( – user11232 Jun 4 '13 at 0:42
  • 1
    Yeah, PhilTeX disappeared. Hopefully it will reappear if the owner renews the registration. Temporarily, I changed the link the ArchLinux AUR page, from which you can find related info. – frabjous Aug 13 '13 at 19:13
  • I was really hoping someone would take over my project after I provided the proof of concept. You can download my files here if you want to play around with them. – frabjous Nov 23 '15 at 20:53
  • @frabjous proof-of-concept is too early for an open source project to get traction so others want to pick it up if the original author abandons it. – Thorbjørn Ravn Andersen Apr 12 '16 at 10:43
17

The most commonly used are Evince and Okular (whether you are respectively using GNOME/XFCE or KDE).

  • Thanks for the suggestion. I have Evince, but I need to update it. – jlconlin Sep 19 '11 at 22:06
8

I'd also give TeXworks and its built-in pdf viewer a shot. Whether you compile your input from the command line or via a click on the green button on the top-left of the TeXworks window, its built-in pdf viewer will update right away. TeXworks runs on multiple platforms, including Linux, and is part of the TeXLive distribution.

4

zathura is a highly customizable and functional document viewer. It provides a minimalistic and space saving interface as well as an easy usage that mainly focuses on keyboard interaction. It offers a vim-like experience and most settings can be customized.

Main features:

  • automatic document reloading
  • supports PDF, PostScript and DjVu
  • mouse-free navigation
  • quickmarks support
  • bookmarks support

zathura

3

It may not be as fancy as the newer programs, but GV (aka the renovated "GhostView") has the ability to "watch" files. Although thought of as a PostScript viewer, it can also display PDF. Invoke as:

gv --watch file.pdf
2

I settled on using xpdf. It's not the prettiest, but it was already available on my system. The way things are set up here at work, it is very difficult if not impossible to build something new, so using something that already existed was the easiest solution.

To get xpdf to update, you simply have to push r and it will refresh. I can live with that. I would have liked to use TeXworks, but compiling on the system was way too difficult.

  • 2
    while I realize that this solved your problem. I think that this answer doesn't answer your question. I am compelled to give it a -1. – Yossi Farjoun Oct 5 '11 at 14:49
  • Under the constraints I have (difficulty in installing software) xpdf works just fine. Perhaps I should have stated that in my original question. – jlconlin Oct 5 '11 at 22:23
  • I still think that you are accepting this answer because that's what you ended up doing. However, what you ended up doing is not a solution to the question you asked. it would be like me asking how to type an integral and then realize that I actually wanted a sum so I write that as an answer and accept it... – Yossi Farjoun Oct 6 '11 at 14:56
  • xpdf has a -reload command line argument. It's not automatic but it can easily be hooked into the TeX compilation workflow to update the PDF after a successful compilation. – Marco May 22 '13 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.