Running Doom Emacs 2.0.9 on Emacs 26.3.

Currenly, when I do TeX-command-run-all on a tex file, it opens the output in okular pdf viewer in a separate KDE window.

I was wondering if it is possible to have the output displayed natively in emacs in a vertically split window next to the tex file window.


You'll first need something that renders pdf files in Emacs and plays well with Latex such as pdf-tools. Then you'll need to setup AucTex. Here are my configurations for both of these. Note that there maybe other possible configurations that achieve the same end result but since I have gotten this to work for me, I am sharing this,

;; pdf-tools
(use-package pdf-tools
  :ensure t

;; auctex
(use-package auctex
  :ensure t 
  :after latex
  (setq tab-width 2 
        LaTeX-item-indent 0 latex "latex"
        pdf-latex-command "xelatex"
        TeX-view-program-selection '((output-pdf "PDF Tools"))
        '(("PDF Tools" TeX-pdf-tools-sync-view)))
  (setq-default TeX-engine 'xetex)
  ;; (TeX-after-compilation-finished-functions
  ;;  . TeX-revert-document-buffer)
  (LaTeX-mode .
                 '("XeLaTeX" "%`xelatex --synctex=1%(mode)%' %t"
                   TeX-run-TeX nil t))
                (setq TeX-command-default "XeLaTeX"
                      TeX-source-correlate-mode t)))
  :bind (:map LaTeX-mode-map
              ("C-c C-c" .
               (lambda (ARG)
                 (interactive "P")
                 (TeX-command-run-all ARG)))
              ("C-l <backspace>"
               . (lambda () 
                   (message "Cleaned!")))))

You may want to adjust these as per your need and then try C-c C-c.

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.