1

This is migrated from the LaTeX stack exchange. I am using Emacs on the Mavericks OSX Terminal. I can open the TeX file fine, but I can compile a pdf via C-c C-c. Is there some way that I can open the pdf in an external window via the command line? I tried running C-c C-c and then C-c C-c again, but it said that was undefined. I have also looked here:

https://tex.stackexchange.com/questions/11613/launching-an-external-pdf-viewer-from-emacs-auctex-on-a-mac-osx-fails

But that didn't work either. I would really like to be able to run LaTeX in Emacs from the command line, but I do a lot of live TeXing and I need to continuously check the pdf. Can someone help me fix this problem?

1

2 Answers 2

2

This is one way of doing what you want to do; there are other solutions too.

This involves installing the Skim pdf viewer, which can interact with emacs. Then if you add the following to your .emacs file, it will set up skim open upon running the view command. AucTex will suggest this command after you compile C-c C-c (in the same way it will suggest BibTeX).

(setq TeX-view-program-selection '((output-pdf "PDF Viewer")))
(setq TeX-view-program-list
      '(("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b")))

The LaTeX preview pane package for emacs may also be an option for you.

1

On a Mac the "open" command can be used to display most types of files, and it'll certainly work for a PDF. So, one way to do it would be to press M-! which runs Emacs' shell-command, which prompts you for the command to run. Enter "open foo.pdf" (or whatever your PDF is called) and it'll get loaded by Preview. If you use this a lot you could bind it to a key (maybe C-c C-v, which in latex-mode is bound to tex-view which is used for previewing a dvi file), but given that Preview will automatically reload and redisplay the file when it changes it's probably not even worth the effort.

Your Answer

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

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