Install AucTeX

  1. Extract the files

    Extract the Auctex archive to your common site-lisp directory, e.g. C:\Programs\emacsen\site-lisp. Be sure to keep directory information and long filenames. A new subdirectory will be created for the Auctex files.

  2. Move tex-site.el

    Locate the file tex-site.el in the Auctex subdirectory that was created in the previous step and move it one level up to the \site-lisp directory in your common Emacs directory.

  3. Byte-compile the files

    Start Emacs and byte-compile the Auctex subdir by typing (the 0 is a zero) Ctrl-u 0 Alt-x byte-recompile-directory [Return] C:/Programs/emacsen/site-lisp/auctex-11.10 [Return]. Some more files are in the style subdirectory, so you should also run Ctrl-u 0 Alt-x byte-recompile-directory [Return] C:/Programs/emacsen/site-lisp/auctex-11.10/style [Return].

  4. Modify tex-site.el

    Edit tex-site.el in the \emacsen\site-lisp subdirectory. Locate the line:

         
          (defvar TeX-lisp-directory "@AUCDIR"
          "*The directory where the AUC TeX lisp files are located.")
          
       
    

    and replace the string @AUCDIR with your Auctex directory, e.g. C:/Programs/emacsen/site-lisp/auctex-11.10.

    Immediately after these lines, insert the following code (modified from tex.el):

         
          ;; Change this to point to the place where the TeX macros are stored
          ;; at yourt site.
          (defcustom TeX-macro-global '("c:/Programs/TeXLive/texmf/tex/")
          "Directories containing the sites TeX macro files and style files.
          The directory names *must* end with a slash."
          :group 'TeX-file
          :type '(repeat (directory :format "%v")))
    
          ;; The 'TeX-command-list' (pull-down menu at the top of emacs appearing when 
          ;; emacs is in TeX major mode) consists of the options below.
          ;; Invoking 'C-c C-c' in a TeX major mode will run the "LaTeX" command
          ;; of the command list. (After compiling, errors can be retrieved by
          ;; invoking 'C-c `' (Control-c accent-gr\`ave).
          ;; If no errors occur and if all cross-references are known, a second
          ;; 'C-c C-c' will run the 'View' command of the list.
          (defvar TeX-command-list 
          (list (list "TeX" "tex \\nonstopmode\\input{%t}" 'TeX-run-TeX nil t)
          (list "LaTeX" "latex \\nonstopmode\\input{%t}" 
          'TeX-run-LaTeX nil t) 
          (list "View DVI" "windvi.exe %d" 
          'TeX-run-command nil t) 
          (list "PDFLaTeX" "pdflatex \\nonstopmode\\input{%t}" 
          'TeX-run-LaTeX nil t) 
          (list "View PDF" "gsview32.exe %a" 
          'TeX-run-command nil t) 
          (list "dviPS" "dvips %d -o %f" 
          'TeX-run-command nil t) 
          (list "View PostScript" "gsview32.exe %f" 
          'TeX-run-command nil t) 
          (list "BibTeX" "bibtex %s" 'TeX-run-BibTeX nil nil) 
          (list "Index" "makeindex %s" 'TeX-run-command nil t) 
          (list "Check" "lacheck %s" 'TeX-run-compile nil t) 
          (list "Other" "" 'TeX-run-command t t)))
    
          (setq TeX-default-mode 'LaTeX-mode)
          (setq LaTeX-command-style '(("." "latex --src-specials")))
          (setq TeX-view-style '(("^a5$" "windvi %d -paper a5")
          ("^landscape$" "windvi %d -paper a4r -s 4")
          ("^epsf$" "gsview32 %f")
          ("." "windvi -single %d")))
          
       
    

    On line 3 of the inserted code the variable TeX-macro-global must point to your local TeX macro subdirectory (the trailing slash is mandatory).

    Close to the bottom of this file you will find the following code:

         
          ;;; Try to make life easy for MikTeX users.
    
          (when (memq system-type '(windows-nt))
          (require 'tex-mik))
          
       
    

    Comment out the last two lines by adding a semicolon ";" in front of each line. The advantages of tex-mik.el or the equivalent tex-fptex.el have been included into the patch that you inserted manually. This allows to use the code not only on WinNT, but also on Win95/98/ME.

    Save the file and then byte-compile the file by typing Alt-x byte-compile-file [Return] site-lisp-Path\tex-site.el [Return], where site-lisp-Path is the full path of your site-lisp directory, e.g. C:\Programs\emacsen\site-lisp. This will create the file tex-site.elc.

  5. Modify _emacs

    Add the following code to your _emacs file to load TeX support at Emacs startup:

         
          ;; add TeX-support
          (load "tex-site")
          (custom-set-variables
          '(TeX-expand-list (quote (("%p" TeX-printer-query)
          ("%q" (lambda nil (TeX-printer-query TeX-queue-command 2)))
          ("%v" TeX-style-check (("^a5$" "windvi %d -paper a5")
          ("^landscape$" "windvi %d -paper a4r -s 4") ("." "windvi %d")))
          ("%l" TeX-style-check (("." "latex"))) ("%s" file nil t) ("%t" file t t)
          ("%n" TeX-current-line) ("%d" file "dvi" t) ("%f" file "ps" t)
          ("%a" file "pdf" t)))))