0

Consider the following LaTeX document.

\documentclass{article} \usepackage{libertine} \usepackage{fontspec} \usepackage{polyglossia} \iffalse \setdefaultlanguage{hebrew} \fi \begin{document} Hello, world! \end{document} 

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?

6
  • 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. Commented Jan 7, 2015 at 17:33
  • 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.) Commented Jan 7, 2015 at 18:46
  • @Dan: I compiled it first to no avail. The toolbar View button doesn't work either. When clicked, the message tool-bar view- appears in the echo line, and nothing more. In particular, the pdf viewer does not open. The same behavior registers (both when using the keyboard shortcuts as well as when clicking the button) when the \iffalse ... \fi directives are in place. Commented Jan 7, 2015 at 18:52
  • 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). 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. Commented Jan 7, 2015 at 19:06

1 Answer 1

2

(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.
2
  • 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. 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. Commented Jan 7, 2015 at 20:25

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.