Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have been trying to get Skim to start from emacs. I always get no "matching viewer found". Here are the settings of my .emacs and I am sure something is wrong here, but cannot figure it out. Any help appreciated.

Thanks

(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)
(setq command-line-default-directory "~/")
(setq TeX-source-correlate-method 'synctex)
(setq reftex-ref-macro-prompt nil)
(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)"\""))
 ;; This line tells emacs where to find the latex compiler
 (setenv "PATH" (concat "/usr/texbin:" (getenv "PATH")))
'(LaTeX-command "latex -synctex=1")
(add-hook 'TeX-mode-hook
(lambda ()
(add-to-list 'TeX-output-view-style
'("^pdf$" "."
"/Applications/Skim.app/Contents/SharedSupport/displayline -b %q %n %o %b")))
)
 ;; start emacs in server mode so that skim can talk to it
(server-start);
;; This line tells emacs to create pdf files instead of dvi files.
(setq-default TeX-PDF-mode t)
(setq TeX-view-program-list
'(("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %q   %n %o %b")))
(setq TeX-view-program-selection '((output-pdf "PDF Viewer")))
share|improve this question
    
Can you open Skim from the command line using /Applications/Skim.app/Contents/SharedSupport/displayline -b -g <filename>.pdf? –  cfr Jun 3 at 0:17
    
No I cannot. I get "34:47: syntax error: A unknown token can’t go after this identifier. (-2740)" –  Nimonika Jun 3 at 7:53
    
I sorted this out. I actually opened the Auctex settings for Tex-command in emacs and found that for some reason, the Tex command for viewing pdf-output was not set to the PDF Viewer in the .emacs file. I did this manually and now I can open pdfs from emacs. –  Nimonika Jun 3 at 8:49

1 Answer 1

up vote 0 down vote accepted

I sorted this out. I actually manually opened the Auctex settings for Tex-command in Emacs and found that for some reason, the Tex command for viewing pdf-output was not set to the PDF Viewer in the .emacs file. I did this manually and now I can open pdfs from emacs. Doing this changed the settings in my .emacs file quite a bit. Below is the extra text that was added by Emacs. I have not had the time to reconcile what I had added manually to the .emacs and what Emacs added. A lot of the text below is actually redundant to pdf viewing and I will clean it up at leisure, but for now everything works.

(custom-set-variables
;; 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-output-view-style (quote (("^pdf$" "." "/Applications/Skim.app/Contents     
 /SharedSupport/displayline %q %n %o %b") ("^dvi$" ("^landscape$" 
 "^pstricks$\\|^pst-\\|^psfrag$") "%(o?)dvips -t landscape %d -o && gv %f") ("^dvi$" 
 "^pstricks$\\|^pst-\\|^psfrag$" "%(o?)dvips %d -o && gv %f") ("^dvi$" ("^\\(?:a4
 \\(?:dutch\\|paper\\|wide\\)\\|sem-a4\\)$" "^landscape$") "%(o?)xdvi %dS -paper a4r 
 -s 0 %d") ("^dvi$" "^\\(?:a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4\\)$" "%(o?)xdvi 
 %dS -paper a4 %d") ("^dvi$" ("^\\(?:a5\\(?:comb\\|paper\\)\\)$" "^landscape$") 
"%(o?)xdvi %dS -paper a5r -s 0 %d") ("^dvi$" "^\\(?:a5\\(?:comb\\|paper\\)\\)$" 
"%(o?)xdvi %dS -paper a5 %d") ("^dvi$" "^b5paper$" "%(o?)xdvi %dS -paper b5 %d") 
("^dvi$" "^letterpaper$" "%(o?)xdvi %dS -paper us %d") ("^dvi$" "^legalpaper$" 
"%(o?)xdvi %dS -paper legal %d") ("^dvi$" "^executivepaper$" "%(o?)xdvi %dS -paper 
7.25x10.5in %d") ("^dvi$" "." "%(o?)xdvi %dS %d") ("^pdf$" "." "xpdf -remote %s 
-raise %o %(outpage)") ("^html?$" "." "netscape %o"))))
'(TeX-view-program-selection (quote (((output-dvi style-pstricks output-pdf) "dvips 
 and gv") (output-dvi "xdvi") (output-html "xdg-open") (output-pdf "PDF Viewer")))))
share|improve this answer
    
For more ideas regarding how one might go about setting up the user-configuration file for OSX and Windows, here is a link to my setup: tex.stackexchange.com/a/156617/26911 –  lawlist Jul 3 at 18:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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