Using LaTeX on Windows

What is the intention of this document?

The intention of this document is to present step-by-step installation of full inexpensive LaTeX system on Windows in a short, but direct and clear way. For those who do it for the first time it is a must read. The rest might find it as a useful reminder. Please note, some basic knowledge of computer is necessary.

I also suppose that you know basics of LaTeX. If not see The (Not So) Short Introduction to LaTeX2e. I also recommend two great books:

• Leslie Lamport: LaTeX
• Michel Goossens, Frank Mittelbach and Alexander Samarin: The LaTeX companion

Why would someone use LaTeX instead of Word in the first place?

Although Word is a useful and practical tool for writing short and (very) simple documents, it becomes too complex or even unusable when one wants the word processor to do more complicated tasks. Moreover, many rather commonly needed features, like user-customised automated numbering or various automated indexes, cannot be created using Word at all. LaTeX does require more effort and time to learn to use even for simpler tasks, but once learned, difficult tasks can be accomplished rather easily and straightforwardly. Therefore, LaTeX is simpler, faster and better way to produce large or complex documents and the additional effort eventually pays off. Additionally, LaTeX is especially well suited for scientific and technical reports, even shorter ones. Writing only one diploma or master or doctor dissertation will pay off all your additional effort. And not to be forgotten - LaTeX is completely free of charge!

OK. I want to use LaTeX on Windows. What do I need?

Unfortunately, this is not a trivial question. The whole process will take some time, but much less time than learning LaTeX anyway (if you have clear and simple instructions like below). Namely there are several programs from several places you need to make things working.

1. Text editor

... to create LaTeX documents. You can use any text editor you like! Some text editors are, however, preferred, because they have syntax highlighting, that is program show LaTeX commands differently than the rest of the text (e.g. different colour). See the comparison of TeX editors.

2. PostScript output

... to create EPS graphics for use with LaTeX. (EPS graphics are natural but not exclusive for use with LaTeX.) Your favourite program(s) do not have EPS output? Simply install dummy PostScript printer to your system. You can actually use any PostScript printer you wish, however I recommend free Generic PostScript Printer from Adobe. Now you can simply print from your favourite program(s) to dummy PostScript printer you just have installed, any you will get genuine EPS files. But please beware next three things:

• During the installation do not forget to choose FILE: as a port to print to (to make it dummy printer).
• After the installation go open properties of the printer and in `Printing preferences/Advanced/Document Options/PostScript Options` choose Encapsulated PostScript (EPS) for PostScript Output Option.
• Every time you create EPS file you have to change `.prn` extension to `.eps` extension.

3. LaTeX compiler

... to make real documents out of your LaTeX source file. MiKTeX is a free LaTeX compiler for Windows and its installation is extremely simple. LaTeX compiler produces so called DVI file, which can be then inspected and printed by YAP DVI viewer, which is included in the package.

4. PostScript viewer

... to view/print your documents. Of course in general you can inspect and print LaTeX documents using YAP DVI viewer. However, if your document includes EPS graphics, then you need PostScript Viewer. There is a freeware GSView for Windows available! Remember, you have to install both GhostScript and GSView to make latter working! I specify, for the sake of order, the same installation folder (e.g. `c:\tex`) for all installations and packages!

Great! I have them all installed! Is that all I need to do?

In principle yes. But there are several tricks and settings you will find useful or inevitable in future use of LaTeX.

All EPS files include bounding box data, which define the frame in which the graphics is located. EPS files created by the procedure explained in the previous section have a bounding box, which usually corresponds to the margins of the paper size. However, usually you want EPS graphics bounding box to be adjusted to real borders of the drawing to get rid of the white margins which choke space in your LaTeX document. You can adjust bounding box by using `epstool` utility that can be downloaded from the GSView web site. (GSView option `File/EPS to PS` will do this too, but it is not very reliable.) Create the batch file `epscrop.bat`:

``````
@echo off
c:\tex\epstool-3.08\bin\epstool --copy -b %1.eps %1.tmp.eps
move /y %1.tmp.eps %1.eps
``````

Please replace above `c:\tex\epstool-3.08\` folder with your own Epstool installation folder. Writing `epscrop myfile` will adjust very reliably bounding box in `myfile.eps`.

2. New packages folder.

Sometimes you need to put different additional non-standard packages and bibliographic styles to your computer. It is usual that you put packages in `\tex\latex\packagename` and bibliographic styles in `\bibtex\stylename` folders relative to your local TeX folder. In older versions of MikTeX local TeX folder was selectable during installation. In newer versions there are two default local TeX folders:

• `C:\Documents and Settings\All Users\Application Data\MiKTeX\X.Y` for all users,
• `C:\Documents and Settings\USER_NAME\Application Data\MiKTeX\X.Y` for user USER_NAME.

`X.Y` stands for MikTeX version. After adding packages and styles run MikTeX Settings (Options) and refresh FNDB for local TeX folders in the `General` tab. New packages and styles will be afterward found and used automatically!

3. Inverse search.

While viewing the LaTeXed document with YAP DVI viewer, you might want to edit the specific part of the source document. Inverse search enables you that by double-clicking this particular part in the DVI viewer, you jump directly to the editor in the specific source line! To achieve it you have to do two following things:

• Tell MiKTeX to put source specials into the DVI file. You do that by specifying the option `--src`.
• Tell YAP in Use/Option/Inverse search how to run your LaTeX editor to specific document and line in it. For example, that line for UltraEdit is `"c:\path\uedit32.exe" %f/%l`

YAP puts file name instead of `%f` and line number instead of `%l`. You should check your favourite editor manual to find out the right content of the line for you. In case you know the specific lines for other text editors, please send them to me and they will be added to this document.

Important! Inverse search does not function well in two-column environment.

4. Compile jump.

While compiling your file with LaTeX, you might want to edit the specific part of the source document, where an reported error has occurred. You can invoke the editor by pressing `e` in the error menu, provided that you have specified to MikTeX how to run your LaTeX editor to specific document and line in it. You can do that by putting `Editor=` line in `[TeX]` section in the `miktex.ini`. For example the line(s) for UltraEdit are:

``````
[TeX]
...
Editor="c:\path\uedit32.exe %f/%l"
``````

MikTeX puts file name instead of `%f` and line number instead of `%l`. You should check your favourite editor manual to find out the right content of line for you. In case you know the specific lines for other text editors, please send them to me and they will be added to this document.

We are done! Happy LaTeXing!

Please report what else would you like to see here, suggestions, new tricks etc. to the author using feedback form.

Created by Marko Pinteric: feedback form.

Updated . Web page has been read by visitors since September 2004.