[Tex/LaTex] Emacs AUCTeX View command

auctexemacsmacviewers

I need help using the View command in AUCTeX running in Emacs. This is essential for viewing PDFs and without it I can not make TeX documents. In my .emacs file I have the following (which was created by M-x customize-variable):

(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-view-program-list (quote (("Preview" "\"open -a Preview.app %o\""))))

Now I open up a .tex document and enter C-c C-c (I have already compiled):

Emacs gives: Command: (default View)

I hit enter

Emacs gives this default command: View command: dvi2tty -q -w 132

I hit enter and Emacs says: View: done. but displays nothing in a PDF reader!

dvi2tty is intended for text only devices, and the command actually creates a new buffer in Emacs which attempts to display the PDF file (it is very messy). Anyway, if I replace dvi2tty -q -w 132 with `open -a Preview.app %o' (I am running Mac os X 10.8.4 and Preview is the name of the default PDF reader) then Preview opens the PDF!

  1. How do I change the default View command from dvi2tty -q -w 132 to open -a Preview.app %o?

All help is greatly appreciated!

Best Answer

I got lucky and found a solution!

Follow these steps

  1. M-x customize-variable
  2. Emacs gives: Customize variable: Enter: TeX-command-list
  3. Search for View (enter C-s and then type `View)
  4. Emacs will take you to the view command where you can enter text.

It will look something like this (after Command there will be a place for text entry):

[INS] [DEL] Name: View                                                                                 
            Command: open -a Preview.app %s.pdf                                                        
            How: [Value Menu] TeX-run-command                                                          
            Create a process for NAME using COMMAND to process FILE. More                              
            Prompt: [Toggle]  on (non-nil)                                                             
            Modes: [Value Menu] All                                                                    
            Menu elements:                                                                             
            [INS] [DEL] Lisp expression: :help                                                         
            [INS] [DEL] Lisp expression: "Run Text viewer"

Change the text after Command: to whatever you need. This will automatically change your ~/.emacs file.