Configuring AUCTeX to use Zathura as pdf viewer

Thu 2015-03-12

For years I could not figure out how to tell emacs »No, I do not want evince as my pdf viewer, use something else« -- except by editing the default command line by hand each time.

But, mark your calendars, today is the day where I found it.

These are the magic lines to add to your .emacs file:

(custom-set-variables
 ;; Your other configuration here
 ;; ...
 '(TeX-view-program-list (quote (("Zathura" "zathura %o")))) ; [1]
 '(TeX-view-program-selection
  (quote
   (((output-dvi style-pstricks) "dvips and gv")
   (output-dvi "xdvi")
   (output-pdf "Zathura")                                    ; [2]
   (output-html "xdg-open")))))

Of course the same thing can be configured via M-x customize-group [RET] auctex [RET] and then choosing TeX Command > TeX View.

The trick is: First [1] you tell emacs about your new viewer by adding a list of its name and the command to execute to TeX-view-program-list.

Then [2] you have to tell emacs to actually use your newly defined program by setting the given name as the second part of the output-pdf predicate in the TeX-view-program-selection alist.

This works for emacs version 24.4 with auctex version 11.88, next version might be different, who knows.

Tags:

This text by Ludger Sandig is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.