6

The C-c C-v command in emacs. Sometimes it asks what viewer to use, and sometimes it just shows the document. If possible (within reasonable effort), I'd like it to never ask, just show.

Also, where is the default view tool command defined? I'd like to know how to set it, as I'd like to append options, so it (for example) will look like this evince --fullscreen (or just -f) instead of just evince.

The mode that I use is LaTeX/P.

(In response to a comment)

/etc/gnome/defaults.list:

application/pdf=evince.desktop
application/x-bzpdf=evince.desktop
application/x-gzpdf=evince.desktop
application/postscript=evince.desktop
application/x-bzpostscript=evince.desktop
application/x-gzpostscript=evince.desktop
image/x-eps=evince.desktop
image/x-bzeps=evince.desktop
image/x-gzeps=evince.desktop
application/x-dvi=evince.desktop
application/x-bzdvi=evince.desktop
application/x-gzdvi=evince.desktop
image/vnd.djvu=evince.desktop
image/tiff=evince.desktop
application/x-cbr=evince.desktop
application/x-cbz=evince.desktop
application/x-cb7=evince.desktop
Emanuel Berg
  • 1,827
  • What is your desktop environment? Under Ubuntu 11.10, emacs (23.3.1) calls xdg-open, which you can set with the command xdg-mime. As far as I remember, it is reading from a defaults.list file; you may have one in something like ~/.local/share/applications or /etc/gnome/defaults.list. ... And, for what it's worth, C-c C-v never asks me about the viewer; have you changed your default view settings? – jon Jun 03 '12 at 23:12
  • In /etc/gnome/, I found the file you mentioned (see post edit). There were some evince related stuff there, but nothing to do (?). Isn't this something you fix within emacs, or put in your .emacs file? (I have not configured C-c C-v.) – Emanuel Berg Jun 03 '12 at 23:36
  • Sorry, I was trying to find out simpler information but got sidetracked. I wasn't sure what your set-up was (GNOME), or if you had fiddled with your (system-wide) .pdf viewer settings. The first line you posted from defaults.list suggests that emacs shouldn't bother asking about which viewer to use..? Can you describe more explicitly when it does or doesn't ask? As for the --fullscreen option, I've never worried about that before. (I'll take a look, but others might be much quicker.) – jon Jun 04 '12 at 00:51
  • There is, for starters: M-x customize-variable RET TeX-view-program-selection. – jon Jun 04 '12 at 01:02
  • You can also customize TeX-output-view-style, but I can't get it to accept the -f option for some reason. – jon Jun 04 '12 at 01:24
  • I can’t explain the code, but here are two lines from my .emacs which you can try, substituting “evince” where I have “mupdf.” Sorry, I can’t tell you about fullscreen — one thing I like about mupdf is that it takes up so little screen real estate.

    Line 1: '(TeX-output-view-style (quote (("^dvi$" "." "evince %o") ("^ps$" "." "evince %o") ("^pdf$" "." "mupdf %o") ("^html?$" "." "firefox %o")))) Line 2: '(TeX-view-program-selection (quote (((output-dvi style-pstricks) "Evince") (output-dvi "Evince") (output-pdf "xdg-open") (output-html "xdg-open"))))

    – Thérèse Jun 04 '12 at 01:49
  • @Thérèse -- this looks like you used customize-variable. But what is your default viewer? (Try opening a .pdf with xdg-open to test.) Incidentally, I too like mupdf for regular viewing; you may also find zathura to your liking. It has better support for bookmarks. – jon Jun 04 '12 at 02:55
  • @jon — Yes, I used customize-variable; unfortunately, it’s not very friendly in the case of these two items, and I tried many times before stumbling upon a formula that worked. My xdg-open for pdf is mupdf (I don’t know why I need both TeX-output-view-style and TeX-view-program-selection…), and you’re right that zathura is very useful. – Thérèse Jun 04 '12 at 06:34

1 Answers1

5

First things first, if you don't know what you are doing, use the M-x customize-variable to modify TeX-output-view-style and TeX-view-program-selection; from these menus, you should be able to declare that you want to use evince --fullscreen for the first variable, and Evince for the second. If you do this, you should end up with the following in your .emacs (cut down to the relevant portions):

(custom-set-variables
;; default warning comments from the customize-variable command
  '(TeX-output-view-style (quote (("^pdf$" "." "evince --fullscreen %o") ...<other options will be declared>...
   )
  '(TeX-view-program-selection (quote ( ...< various options >... (output-pdf "Evince") ...)))

Note: do not cut and paste any of the above. I'm just showing you the parts that should be of interest to you.

With these settings, now C-c C-v and C-c C-c (once AUCTeX thinks it's the appropriate action) will use Evince with the --fullscreen option.

jon
  • 22,325
  • TeX-output-view-style seems to have no effect. I can put whatever there and it does not change the behavior. TeX-view-program-selection on the other hand, if I put something nonsensical there, it breaks the viewing altogether. – Emanuel Berg Jun 08 '12 at 12:35
  • @EmanuelBerg -- did you use both at the same time? I took all this stuff, because I don't want to call Evince with --fullscreen, but when I made the changes, TeX-ouput-view-style listed several instances for pdf. I made all of them follow the pattern shown above; but do not try to give options to TeX-view-program-selection. Perhaps you could edit your question to show what you get in .emacs after using M-x customize-variable. (You can get rid of the defaults.list stuff, but it might be worth mentioning the OS/etc. for future readers of the question.) – jon Jun 08 '12 at 15:32
  • It looks like this: (custom-set-variables '(TeX-output-view-style (quote (("^pdf$" "." "evince --fullscreen %o")))) '(TeX-view-program-selection (quote ((output-pdf "Evince")))) ; and then some unrelated things. TeX-output-view-style does not seem to affect anything with or without TeX-view-program-selection. But TeX-view-program-selection works as we expect it to, replacing Evince with xpdf and you get a xpdf window instead. – Emanuel Berg Jun 08 '12 at 16:00
  • Really? You made the change with M-x customize-variable, and it only made an addition for pdf? When I went through the process, it gave me settings for .pdf, .dvi, .html, etc.; in some cases 'double' settings (for reasons I don't know). – jon Jun 08 '12 at 16:03
  • Yes. I have GNU Emacs 23.4.1 and did exactly as you in LaTeX/P mode. Anyway, I'll start reading the documentation more closely and get back to you if I solve this. It seems such an easy fix it is too annoying to fail. – Emanuel Berg Jun 08 '12 at 16:08