I wanted to set up auctex to use mupdf as the pdf viewer it ran when I do C-c C-v. So I customize-variable on TeX-view-program-list to include a line for MuPDF and customize-variable on TeX-view-program-selection to select MuPDF. But when I run C-c C-v, I get the error: Cannot find "MuPDF" viewer. My .emacs contains the following relevant lines:

 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(TeX-view-program-list (quote (("MuPDF" ("mupdf %s.pdf") ""))))
    (((output-dvi has-no-display-manager)
     ((output-dvi style-pstricks)
      "dvips and gv")
     (output-dvi "xdvi")
     (output-pdf "MuPDF")
     (output-html "xdg-open"))))

So what on earth is going on!? getenv PATH returns a list of paths that includes the location of mupdf, but I don't think that's relevant since the error has "MuPDF" capitalised... Pretty much exactly the same set-up works fine on my laptop.

I'm on emacs 24 (installed with the package manager on ubuntu) and auctex 11.90.0 (installed through emacs with list-packages)

  • Please double check that Emacs finds mupdf and eval this (executable-find "mupdf") in *scratch* buffer. Then, try to customize TeX-view-program-list to ("MuPDF" "mupdf %o" "mupdf"). Mar 6, 2017 at 12:32
  • @ArashEsbati The second part of your comment seems to have solved the problem. Could you perhaps write an answer explaining why this worked? i.e. what is the third element of the list doing?
    – Seamus
    Mar 6, 2017 at 12:52

1 Answer 1


Part of docstring from TeX-view-program-list says:

TeX-view-program-list is a variable defined in ‘tex.el’.
Its value is nil

List of viewer specifications. This variable can be used to specify how a viewer is to be invoked and thereby add new viewers on top of the built-in list of viewers defined in ‘TeX-view-program-list-builtin’ or override entries in the latter.

AUCTeX comes with a lot of viewers pre-configured. They are stored in TeX-view-program-list-builtin. Checking this variable is helpful if you plan to switch your viewer.

[...] The second element can be a command line to be run as a process or a Lisp function to be executed. The command line can either be specified as a single string or a list of strings and two-part lists.

This is what I suggested: Putting the command line in a single string "mupdf %o".

Note that the command line can contain placeholders as defined in ‘TeX-expand-list’ which are expanded before the viewer is called.

This is for the %o part: %o expands to output file incl. the file extension.

The third element of the item is optional and is a string, or a list of strings, with the name of the executable, or executables, needed to open the output file in the viewer. Placeholders defined in ‘TeX-expand-list’ can be used here. This element is used to check whether the viewer is actually available on the system.

This is for the last "mupdf". Putting it together, ("MuPDF" "mupdf %o" "mupdf") should do the job. I'm not sure if MuPDF has synctex support, though. If yes, this should be added in the second string.

  • I still don't really understand why leaving the third element of the entry caused the command not to work. (Especially since it says it is optional!)
    – Seamus
    Mar 7, 2017 at 10:49
  • @Seamus - I suspect that you get that error due to the empty string "" which you have as optional third argument. You can check this by customizing the variable to ("MuPDF" "mupdf %s.pdf") (which I haven't tested). But using %o is the better choice. Mar 7, 2017 at 15:36
  • But if the way customize-variable customizes the variable (i.e. adding an empty string for the third argument) doesn't work, is this a bug I should report?
    – Seamus
    Mar 7, 2017 at 21:43
  • @Seamus - One question: In customize buffer, did you select No executable from the value menu for Viewer executable(s):? Per default, it looks for One executable:, which will be "" if you leave that field empty and hit Apply and Save. I checked it now: the empty string indeed triggers the issue you've described in your question. Mar 8, 2017 at 11:42
  • Yes that's the problem. "One executable" appears to be the default. Thanks for your help!
    – Seamus
    Mar 8, 2017 at 15:12

Your Answer

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

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