I am running Emacs 26 built with GTK toolkit. AUCTeX has been successfully installed.

1) How to force Emacs to open an Okular session to view the PDF file, instead of opening another window within Emacs (aka DocView)?

2) How to delegate the running of a TeX file to the background (i.e., something like a "quiet" mode when it would not open up a visible new window, but do it in the background)?

  • Emacs 26 is now the stable public release. AucTeX is not integrated/bundled with Emacs and must be separately installed. Type M-x list-packages to see what is available by default, and checkout some threads that describe how to add other source data bases to the package manager such as MELPA. I would suggest first getting AucTeX installed and then see if any of your questions are still relevant ... If you successfully install AucTeX and the questions are still relevant, then please edit the question title and the body of the question and clarify what issues remain unresolved.
    – lawlist
    Feb 3, 2019 at 22:32
  • Thanks. I guess I wasn't clear enough. I started by installing auctex as I always have for the last many many installs. Then I started to use emacs and saw how it works. So I started to play around and finally noticed that auctex makes no difference. Just to test it, I uninstalled auctex and emacs kept working the same way. I didn't mean that auctex was integrated just its functionality. But perhaps just the pdf viewing. In any case, my question is not how I can install auctex, but how I can customize emacs 26. Thank you! Feb 3, 2019 at 22:39
  • I edited the question to remove portions that were extra, and attempted to clarify the real questions that remain. If the edits do not meet your needs, please feel free to re-edit the question accordingly. References to tab have been changed to window, which is Emacs lingo...
    – lawlist
    Feb 3, 2019 at 23:49
  • Great, thanks. (I thought it was "window", but at the same time it seemed weird, since it is in the same ambient window...). :) Feb 3, 2019 at 23:59
  • 1
    Please don't ask multiple questions together. Post each question separately, so that it can be answered independently.
    – phils
    Feb 4, 2019 at 4:17

1 Answer 1


OK, so here is what I have done that seems to have resolved the issue. Let me add the disclaimer that I tried a lot of things, so it is possible that I did something else that affected the outcome, but is not listed here, but I am trying to include all the relevant steps.

All of this is for emacs 26.1

2) was the easier, including the line

(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)

in .emacs did the job. The idea of doing this came from @Manuel Uberti's answer to another question.

To solve issue 1) I tried his other suggestion, but that does not seem to work with the newest emacs version, but a variation of it led to a solution.

So, first one needs to add okular to the TeX-view-program-list variable. This can be done by M-x customize-variable. One little trick is that one has to add the command at two places, once for "command" and once, after selecting "one executable" for that.

Next, set the TeX-view-program-selection variable to okular. An important detail is that one needs to choose it from a dropdown menu and trying to write it directly from .emacs doesn't help. I also had to restart emacs to have it listed. I suppose one can do a refresh instead.

As far as the auctex integration is concerned, it must be included in the emacs26 package, because I uninstalled the version (11.91) that I had installed using synaptic. In emacs25, the listed package version is 12.1. I guess the alternative is that (k)ubuntu is behind in including it in their distro. Perhaps I should add that the latest emacs in synaptic (or rather ubuntu) is version 25.2, I installed emacs version 26.1 from the gnu.org source file.

Your Answer

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

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