This solution does not
depend upon using Aquamacs -- i.e., a generic flavor of Emacs will suffice. As to an OSX version of Emacs (Snow Leopard and Mountain Lion) with package auctex-11.86
, the following lines of code within tex.el
affect viewing *.pdf files:
line 1028: ("Evince" ("evince" (mode-io-correlate " -p %(outpage)") " %o"))
line 1119: (output-pdf "Evince")
Skim.app is widely considered to be the most appropriate *.pdf viewer for OSX *.tex documents because of its ability to auto-update the display when it detects a change of the *.pdf file, and because of its ability to use inverse-search (i.e., command + shift + left-click) to jump back to the text editor at the precise point where the mouse was clicked.
Since the OSX community does not widely use Evince, the work-around is to either modify tex.el or modify the init.el. There is even a notation within tex.el stating that the developers need to coordinate their efforts to implement viewing *.pdf on an OSX system.
The following is a modification of the init.el, which includes a keyboard shortcut of my own choosing. The current version of auctex-11.86
already has in place the keyboard shortcut for 'TeX-view
(C-c C-v). NOTE: The following code configures View to be Jump-To-PDF with synctex enabled, so anyone looking to just have a quick view without synctex will need a slightly different configuration. The keyboard shortcuts I have created are F7 for build; F8 for jump to pdf; and F9 for clean up, but leave the *.pdf and *.tex.
[In the future, I plan on writing some code to use the -output-directory option to /tmp and automatically copy the *.pdf back to the working directory so that clean-up is unnecessary. TexLive does not presently support the -aux-directory option, so the previous solution is the best option to eliminate the clean-up process.]
(global-set-key (kbd "<f7>") 'TeX-command-master) ;; need to set a default for this to work.
(global-set-key (kbd "<f8>") 'TeX-view) ;; jump to *.pdf with synctex (or C-c C-v)
(global-set-key (kbd "<f9>") 'TeX-clean) ;; clean, but leave the *.pdf
(setq TeX-PDF-mode t)
(setq TeX-view-program-selection '((output-pdf "Skim")))
(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)
(setq TeX-source-correlate-method 'synctex)
(add-hook 'LaTeX-mode-hook
(lambda()
(add-to-list 'TeX-expand-list
'("%q" skim-make-url))))
(defun skim-make-url () (concat
(TeX-current-line)
" "
(expand-file-name (funcall file (TeX-output-extension) t)
(file-name-directory (TeX-master-file)))
" "
(buffer-file-name)
))
(setq TeX-view-program-list
'(("Skim" "/Applications/Skim.app/Contents/SharedSupport/displayline %q")))
See also:
https://tex.stackexchange.com/questions/111834/auctex-output-directory-copy-pdf-to-working-directory