How can I set MUPDF as the default viewer in AUCTeX (I mean setting it in the variable Tex-view-program-selection)?
Many thanks
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityHere is (I think) the simplest way to do this. The first adds mupdf as a new view program, while the second specifies it as the default for pdfs.
(with-eval-after-load "tex"
(add-to-list 'TeX-view-program-list '("mupdf" "/path/to/mupdf %o"))
(setcdr (assq 'output-pdf TeX-view-program-selection) '("mupdf")))
In response to a comment, here is how to add support for synctex with mupdf. This only makes mupdf jump to the correct page with C-c C-v
. I believe doing more like inverse search requires some ugly hacks.
(with-eval-after-load "tex"
;; enable synctex support for latex-mode
(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)
;; add a new view program
(add-to-list 'TeX-view-program-list
'(;; arbitrary name for this view program
"my mupdf"
(;; mupdf command (may need an absolute path)
"mupdf"
;; %o expands to the name of the output file
" %o"
;; insert page number if TeX-source-correlate-mode
;; is enabled
(mode-io-correlate " %(outpage)")))
;; use the view command named "my mupdf" for pdf output
(setcdr (assq 'output-pdf TeX-view-program-selection) '("my mupdf"))
/home/gabriel/.emacs': Symbol's value as variable is void: TeX-view-program-list To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the
--debug-init' option to view a complete error backtrace. Any clue how to avoid it? Thanks once again.
Dec 31, 2016 at 15:02