måndag 15 oktober 2007

LaTeX on Windows: The Simple Installation Guide

LaTeX is not only a material, but also a technology for writing and typesetting documents. It is an excellent choice for academics, engineers, scientists, manual authors and others for whom structure is important, but not a great fit for those who wish to tweak every detail of their documents' appearance. It enables rapid creation of documents by taking care of layout, fonts, and the placing of images and tables, while always keeping references and links up to date.

With that introduction taken care of, I recently wanted to build LaTeX documents. On my Linux PC, I had the tools already installed, but on Windows the path was less straight-forward. I initially found a software package called proTeXt, which aims to simplify the installation of a Windows-based LaTeX system. However, I ran into major problems with the finished system that prevented me from using it. As I searched the web, I found several other individuals who had problems. The community surrounding the package was very helpful but no-one had a good idea about the cause of the problem, and I wasn't inclined to spend much more time on it, so I abandoned it in favour of another approach. So here follows what is hopefully a close to fool-proof installation guide. The end result will be a setup that converts LaTeX source to a PDF document. I am not interested in producing PostScript, so this guide will not cover that.

Installing Adobe Acrobat Reader
  1. Download and install Reader from this page or any other way that you prefer.

Installing MiKTeX
  1. Begin by downloading MiKTeX. Get the "basic" version of the installer. At the time of this writing, the latest version can be found here (approx. 70 MB). Start it once downloaded.
  2. Accept the copying conditions by clicking the checkbox and selecting "Next".
  3. Choose whether to install it for any user, or just you, and select "Next".
  4. Select the destination location and click "Next". The default will do fine.
  5. You can now select your preferred paper size (A4 or Letter). Do that, and also answer "Yes" to the question "Install missing packages on-the-fly". Select "Next".
  6. Then click "Start". This will take a while, even with a fast connection.
  7. Eventually, the "Next" button will become enabled again. Select it and then "Close".
Installing TeXnicCenter
  1. Download and run the TeXnicCenter installer from this page. At the time of this writing, version 1 beta 7.01 is the latest. Note that the page includes information about some additional required components. If you run Windows XP SP2 or Windows Vista, none of those need to be downloaded but you may want to look them if you run into problems.
  2. On the welcome page, click "Next".
  3. Choose to accept the license agreement and click "Next".
  4. Select the desired destination folder and click "Next".
  5. Select "Typical" and click "Next".
  6. Click "Next" again.
  7. Deselect the checkbox unless you want items added to your "Send to" menu, and then click "Next".
  8. Click "Install".
  9. Click "Finish".
Configuring TeXnicCenter
  1. Start TeXnicCenter from the Start menu.
  2. The "Tip of the day" may pop up. Select "Close".
  3. The configuration wizard's welcome page should now display since this the application has not been configured. Click "Next".
  4. You will now be asked to select the location of the executables of your TeX distribution. Select the miktex/bin subfolder (important!) of your MiKTeX installation directory. On an English language Windows XP or Vista, that will normally be C:\Program\MiKTeX 2.7\miktex\bin. The screenshot below shows the normal location on a Swedish Windows XP. Select "Next".
  5. On the next page, you are asked to configure PostScript viewers. Skip this and just select "Next".
  6. Now you will be asked to configure a PDF viewer. Select the location of your Acrobat Reader binary. On an English language Windows XP for version 8 of Reader, this is normally C:\Program\Adobe\Reader 8.0\Reader\AcroRd32.exe. Select "Next".
  7. Now select "Finish" to generate default output profiles
Usage
  1. To begin a new project, select File > New Project. From the General tab, select Empty Project.
  2. Enter a project name and select "OK".
  3. Enter your LaTeX source in the empty document that appears. This guide does not teach LaTex but there are many good tutorials out there, this one for example. I liked this Swedish tutorial. You can download this sample document, which is configured for both international characters and for PDF creation with clickable bookmarks.
  4. Select the LaTeX => PDF output profile.
  5. Select the Build Output icon (leftmost icon marked red in screenshot above). The file will be automatically saved.
  6. If there were no errors in the Build window, you can now display the final PDF by selecting the View Output icon (rightmost icon in screenshot). The result should look something like this. You may continue to edit the source code with Reader open in the background -- recent versions will refresh when the file has changed.
That's it!