By Vincent Yeung (April 12, 2006)
preview-latex (now distributed as part of AUCTeX) is a brilliant tool for LaTeX editing. Unfortunately, it is unbelievably painful to set up properly on Windows. The purpose of this document is to hopefully make the process simpler.
This document assumes that you have none of the many UNIX-like tools people eventually install on their Windows system, except for maybe Cygwin. So if you already have XEmacs installed and can't get things to work, don't complain to me.
The following steps will be taken:
KEY INSIGHT: For things to work smoothly, I strongly recommend installing XEmacs and TeX via the Cygwin installer as opposed to separately. This was in part motivated by the fact that as of this writing, http://www.xemacs.org is down. But more practically, doing so allows these tools to be found under reasonable locations in /usr/, which appears to simplify the AUCTeX configuration substantially. If you already have Cygwin installed, run the installer again to get the packages listed below.
Download the cygwin setup.exe from http://www.cygwin.com/. Now run setup.exe. You will be prompted to select a server. Generally the US university ones are quite fast. Then, you will be asked to select the packages to install. Click "View" until it says Full so that you can easily see everything at once. At the minimum, select the following (one or two of these may be redundant, but most are really necessary for preview-latex to work, so don't be stingy with space unless you really know what you're doing):
XEmacs should now be installed on your system. Try to start it from cygwin with xemacs &. You also want to create a ~/.xemacs/xemacs-packages directory for later use.
Download the AUCTeX zip file, and unpack to a conveniently accessible directory.
Now, start cygwin and cd into the directory with AUCTeX (note you can access a windows drive, e.g. C:, in cygwin with /cygdrive/c/). Now run: ./configure --with-xemacs=/usr/bin/xemacs --with-texmf-dir=/usr/share/texmf/ --with-packagedir=~/.xemacs/xemacs-packages.
If you installed XEmacs and TeX via the cygwin installer, then this should work (i.e. end with no errors). It'll ask you to run make. Do so. Hopefully, that also works, and you'll be asked to run make install; do that, and you should be ready to go!
Under the AUCTeX directory you unpacked, there's a file called preview/circ.tex. Open that with XEmacs and try generating previews by clicking Preview » Generate Previews For Document. C-c C-l to see the progress. If all works you should see something like this screenshot.
If you're trying circ.tex and it doesn't seem to work, look in the log with C-c C-l. If it says something like file:line:error style messages enabled, you will need to disable it. (this is a known bug for current versions of AUCTeX — see here). To do so, open /usr/share/texmf/web2c/texmf.cnf (with XEmacs even!), and change the t to f here:
% Enable file:line:error style messages.
file_line_error_style = t (CHANGE TO f)