psumark
 
Logo

Windows XP+Emacs+LaTeX+Spell-Checker

For those who has been exposed to Emacs+Auctex in LaTeX editing, there is really no turning back. It is arguably the best TeX editor out there, and 100% free. But what if you are still not fully ready to embrace the Linux world and forced to live with windows? Here is what worked for me. I should mention that I am no expert in any of the softwares used here. So there is no guarantee. But I do appreciate any feedbacks and suggestions. Please send them to "xue_j AT math.psu.edu".


Requirement:

  • Unpacking utility such as Winrar.
  • Enough space on your disk(500M).
  • I assume we start clean with no previous Emacs, MikTeX, Ghostscript,Gsview,Aspell installed. (Might not be necessary).

Softwares Needed

Installation

This involves either unpacking the packages for Emacs and AucTeX or installing the other softwares the normal way. Here I only list the directory of some typical files on my installation and make a few comments.
emacs.exe C:\Program Files\emacs\bin\emacs.exe
auctex.el C:\Program Files\emacs\site-lisp\auctex.el
gsview32.exe C:\Program Files\ghostgum\gsview\gsview32.exe
gswin32c.exe C:\Program Files\gs\gs8.61\bin\gswin32c.exe
yap.exe C:\Program Files\MiKTeX 2.7\miktex\bin
aspell.exe C:\Program Files\Aspell\bin\aspell.exe
Comments:
  • After unpacking emacs, run
    C:\Program Files\emacs\bin\addpm.exe
    Answer OK to the message box that pops up then GNU Emacs will be added to your start menu, and certain registry keys will be created for you.
  • When unpacking AUCTeX into the emacs folder, it might be a better idea to not overwrite the emacs folders, especially the "info" folder. Copy the files into theirs corresponding folders instead. (Comments?)
  • After the installation of MiKTeX, update it by the menu
    StartMenue>All Programs>MiKTeX 2.7>Update
    Similarly, install the additional packages that might be useful by the "Browse Packages" menu. If you have files that you want to integrate into the MiKTeX setup, see this page.
  • I installed the English dictionary into the Aspell directory.

Set up environment variables

We need to set up a few variables to let emacs and auctex to know where to find the programs and folders. Right click "My Computer" icon and go
My Computer>Properties>Advance>Environment Variables
create a new variable called "PATH"(without the quotation marks) , and set(or append if you already have the "PATH" variable) its value to the following with no line breaks:
c:\program files\emacs\bin; c:\program files\ghostgum\gsview\; c:\program files\gs\gs8.61\lib; c:\program files\gs\gs8.61\bin; c:\program files\Aspell\bin
Also create "HOME" variable and set its value to a directory of your like, say an empty directory like
D:\HOME
or the following to set it to Windows's default documents directory
%USERPROFILE%\My Documents\
Also create "TMP" and "TEMP" variables and set their values to
%USERPROFILE%\Local Settings\Temp

The dot emacs file

In your HOME directory, create a ".emacs" file with the following content.
;; set the current directory to HOME
(cd "~/")
;; some TeX set up for Auctex
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(require 'tex-mik)
;; automatically turn on math-mode for editing tex files.
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
;; automatically turn on auto-fill-mode for editing tex files.
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
;; set up the spell checker.
(setq-default ispell-program-name "aspell")

Configure AUCTeX

In this part we configure the behavior of AUCTeX for pdf previewing, print, etc. I am assuming that Emacs is in LaTeX mode. this can be achieved simply opening or creating a ".tex" file.
  • To use preview ".pdf" files using gsview, open menu
    LaTeX>Customize AUCTeX>Browse Options>Tex Command>Tex Output View Style
    click show value, change the command for the pdf entry from "start %o"$ to "gsview32 -e %o". Go to the top of the page and click save for future sessions. Gsview probably will ask you for a registration key.
  • Normally you don't need to change the preset viewing style for ".dvi" files. But if it says "start %o", change it to "yap -1 %dS %d". Similarly, you may set the software(firefox, for example) to preview ".html" files provided the directory of that software is in the "PATH" variable. I had mine as "firefox %o".
  • To print from mini-buffer, use
    LaTeX>Customize AUCTeX>Browse Options>Tex Command>Tex Print Command
    and set the value to "gsprint %o".
  • I do not suggest previewing ".pdf" using acrobat reader. Yes, ".pdf" files looks a lot in acrobat reader. But acrobat reader do not support live update of the opened file. So whatever small changes you've made with your ".tex" file, in order to compile it, you need to close the acrobat reader and reopen it again, which is a real pain.

So that's it. Do more configuration with Emacs and AUCTeX until you are most comfortable with them, and happy TeXing. Comments and suggestions can be send to "xue_j AT math.psu.edu".

Alternatively, compiling AUCTeX from source.

Basically, we just follow the instructions in "INSTALL.windows" file which comes with AUCTeX. Comparing to "MSYS",I am more comfortable to work with "cygwin", which can be get here.
  • During "cygwin" setup/package selection, I selected the latest version of "autoconf", "automake", "gcc", "gcc-core", "gcc-g++","gdb" and their depend packages in the development category.
  • Command for .configure( with no line breaks)
    ./configure --prefix='C:/Program\ Files/emacs'
             --with-texmf-dir='C:\Program\ Files/MiKTeX\ 2.7'
             --with-lispdir='C:/Program\Files/emacs/site-lisp'
             --infodir='C:/Program\ Files/emacs/info'
  • On a negative note, there doesn't seem to be any uninstall program for Cygwin. There is no such an option in the "Control Panel/add or remove programs". And the user's guide on their webpage mentions nothing about uninstall.

Swap the ctrl and capslock keys

The link explains how to swap the "ctrl" and "capslock" keys so your PC works better with Emacs.
Back to Top
Last updated Feb,2008.