I need help with configuring auctex in emacs. I have downloaded and installed auctex but I cannot get anything to work. I am running MAC OS X 10.8.4 and am running emacs through the terminal. If I use Aquamacs emacs (a GUI emacs for MAC) then I can at least get the View command to work (it opens up the default PDF viewer, which is called Preview).

However, I wish to use emacs through the terminal. I've added the following to my .emacs file:

(load "auctex.el" nil t t) ;; loads tex-site in such a way so that it can be undone              
(load "preview-latex.el" nil t t) ;; actual preview-latex                                        
(setq TeX-view-program-list '(("Shell Default" "open %o")))                                      
(setq TeX-view-program-selection '((output-pdf "Shell Default")))                                
(setq TeX-PDF-mode t)                                                                            
(setq TeX-auto-save t)                                                                           
(setq TeX-parse-self t)                                                                          
(setq-default TeX-master nil)                                                                    
(add-hook 'LaTeX-mode-hook 'visual-line-mode)                                                    
(add-hook 'LaTeX-mode-hook 'flyspell-mode)                                                       
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)                                                     
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)                                                      
(setq reftex-plug-into-AUCTeX t)

Is it even possible to run Latex through the terminal in emacs? I am relatively new to all of this (however I did manage to install everything else I needed such as multiple interpreters and even a web browser!). What I have tried so far is to open up a TeX document (which loads fine and switches to a mode called "LaTeX/MP Ref Wrap" (is that right for Auctex?). I type:C-c C-c

emacs gives me the prompt:Command: (default LaTeX)

My options are:

Possible completions are:                                                                        
BibTeX       Check        Clean        Clean All    File         Index                           
LaTeX        Other        Print        Queue        Spell        View

If I choose to use LaTeX then I get this from emacs:

LaTeX errors in `*~/path/to/file output*'. Use C-c ` to display. 

So I type C-c ` to display the errors and this is what I get from emacs:

ERROR: LaTeX Error: File `etoolbox.sty' not found.                                               

--- TeX said ---                                                                                 

Type X to quit or <RETURN> to proceed,                                                           
or enter new name. (Default extension: sty)                                                      

Enter file name:                                                                                 
! Emergency stop.                                                                                
<read *>                                                                                         

l.28 \def                                                                                        
--- HELP ---                                                                                     
From the .log file...                                                                            

*** (cannot \read from terminal in nonstop modes)
  1. How would I fix this?

    Also, instead of typing LaTeX I tried View. Emacs prompted and auto-completed : View command: dvi2tty -q -w 132 file_name

I hit enter to execute that command and emacs replies:

View: done.

Now there is a new buffer with content:

unning `View' on `combinatorics_bin_trees' with ``dvi2tty -q -w 132 combinatorics_bin_trees''   
/bin/sh: dvi2tty: command not found                                                              

View exited abnormally with code 127 at Fri Jun 14 16:55:35

Note as stated above with Aquamacs Emacs (Emacs for MAC OS X) the View command will open the default PDF viewer, which is called Preview. So I must be missing some kind of package? (this is disappointing considering that I use package managers which do work out dependencies to download all my programs...)

How can I fix this problem? All help is GREATLY appreciated! I am also welcoming any suggestions in tuning auctex settings for emacs and any general links that are help flu (I did not find the emacswiki about auctex to be useful at all!)

closed as off-topic by Joseph Wright Aug 18 '13 at 10:18

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Are you able to compile the document via command line? It seems the compiler isn't able to find etoolbox.sty, probably this isn't a problem with Emacs but with an incomplete LaTeX distribution. – giordano Jun 14 '13 at 21:14
  • 1
    That's my suspicion as well. What does kpsewhich etoolbox.sty give you? – Sean Allred Jun 14 '13 at 23:49
  • kpsewhich etoolbox.sty` does nothing. – CodeKingPlusPlus Jun 17 '13 at 11:20
  • @CodeKingPlusPlus so you should install the etoolbox package in your *TeX distribution. This isn't a problem with Emacs or AUCTeX. – giordano Jun 20 '13 at 22:19
  • My TeX Live download was faulty (I couldn't run the package manager tlmgr) so I downloaded MacTeX and it no longer gave me that error! – CodeKingPlusPlus Jun 21 '13 at 1:08