Consider the following LaTeX document.





Hello, world!


After finishing writing the document, I hit C-c RET twice.

  1. Scenario 1 - with the \iffalse ... \fi as shown

    After the first time the message LaTeX: successfully formatted {1} page appears in the echo line. After the second time the message View command: TeX-evince-sync-view appears in the echo line. If I now hit RET, a pdf viewer opens with the processed document.

  2. Scenario 2 - without the \iffalse and without the \fi tags

    After both the first and the second time the message You should run LaTeX again to get references right, {1} page appears in the echo line. The pdf file is created and, when opened manually, looks fine, but the pdf viewer does not open from within Emacs as in scenario 1.

How can I get the same behavior of scenario 1, specifically the automatic opening of the synched pdf file, under the setup of scenario 2?

  • 1
    I'm speculating that it's some hang-up since you have to use xetex or luatex. However, the simplest thing to do would simply be to use C-c C-v (TeX-view) after you've compiled the file.
    – Dan
    Commented Jan 7, 2015 at 17:33
  • @Dan: Thank, Dan. C-c C-v has no effect.
    – Evan Aad
    Commented Jan 7, 2015 at 18:43
  • 1
    Did you compile it first (eg, with C-c C-c)? After I compile, I get the "You should run LaTeX again..." message to which you're referring, but C-c C-v opens the viewer right up. (Note, also, that you can C-c C-c and select View and it should do the same thing.)
    – Dan
    Commented Jan 7, 2015 at 18:46
  • 1
    Can you check to make sure that compiling actually produced a pdf for the file? FWIW, you may want to (setq TeX-PDF-mode t).
    – Dan
    Commented Jan 7, 2015 at 18:57
  • 1
    Good to hear that it's working. As an aside, you may be interested in Keeping track of a pdf viewer spawned by AUCTeX.
    – Dan
    Commented Jan 7, 2015 at 19:06

1 Answer 1


(Converting running comments to an answer.)

This is a partial solution. It's unclear why AUCTeX perpetually tells you "You should run LaTeX again..." after compiling (but I can confirm that it happened for me as well). Best guess is that it's something about the fact that polyglossia requires either xetex or luatex, and perhaps the latter don't play as well with AUCTeX as does latex.

However: after you compile and create a PDF (to keep it automatic, make sure to set TeX-PDF-mode to t), you can force AUCTeX to display the PDF in one of two ways:

  1. C-c C-v (TeX-view) will open your viewer;
  2. C-c C-c (TeX-command-master) allows you to type View and then opens your viewer.
  • In the output log there is always the line LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right., that's why AUCTeX always suggest to rerun the compiler. There is something weird in some of the loaded packages, it's not AUCTeX' fault.
    – giordano
    Commented Jan 7, 2015 at 20:24
  • @giordano: right, I'm speculating that xetex or luatex is having trouble keeping track of labels, which is why AUCTeX is doing what it does.
    – Dan
    Commented Jan 7, 2015 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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