1

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.

1

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
  :init
  (pdf-tools-install))

;; auctex
(use-package auctex
  :ensure t 
  :after latex
  :init
  (setq tab-width 2 
        LaTeX-item-indent 0 latex "latex"
        pdf-latex-command "xelatex"
        TeX-view-program-selection '((output-pdf "PDF Tools"))
        TeX-view-program-list
        '(("PDF Tools" TeX-pdf-tools-sync-view)))
  (setq-default TeX-engine 'xetex)
  (add-hook
   'TeX-after-compilation-finished-functions
   #'TeX-revert-document-buffer)
  :hook
  ;; (TeX-after-compilation-finished-functions
  ;;  . TeX-revert-document-buffer)
  (LaTeX-mode .
              (lambda()
                (add-to-list
                 'TeX-command-list
                 '("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")
                 (save-buffer)
                 (TeX-command-run-all ARG)))
              ("C-l <backspace>"
               . (lambda () 
                   (interactive) 
                   (TeX-clean) 
                   (message "Cleaned!")))))

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

| improve this answer | |

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.