I am trying to set Emacs/AUCTeX to invoke an external PDF viewer so I can view the document output, preferably with source correlation via SyncTeX. AUCTeX, by default, suggested evince file.pdf
; however, I don't have Evince installed and I figure Skim is a better option.
I searched around for how to go about this and found the following modifications to the .emacs
file that should allow me to do this:
(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")))
(setq TeX-view-program-selection '((output-pdf "Skim")))
The hooks load without complaints. I tested on a filed named sandbox.tex
, which produced the output sandbox.pdf
and the C-c C-c view command
attempts to invoke Skim as follows:
/Applications/Skim.app/Contents/SharedSupport/displayline 1 /path-to-sandbox.pdf /path-to-sandbox.tex
but nothing happens: Skim does not launch nor does AUCTeX complain. I'm stumped here.
I'm using GNU Emacs 23.2.1 (x86_64-apple-darwin10.4.0, NS apple-appkit-1038.32) and AUCTeX v.11.86 on OSX 10.6.6.
2011-02-21 09:05:23.459 osascript[62878:903] Error loading /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: dlopen(/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found. Did find: /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: no matching architecture in universal wrapper osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" declares no loadable handlers.
M-! skim file.pdf
?open foo.pdf
-- or that always worked for me with carbon emacs.