# Setting upLaTeX for Microsoft Windows

All software listed here is "free".

1. Download LaTeX compiler MikTeX (23 to 64MB). (`setup-version.exe` setup wizard ~425KB)

2. Download ghostscript and ghostview for printing, converting and viewing postscript files (`gs???w32.exe` ~5.2 MB and `gsv??w32.exe` ~1.2 MB).

## Files you may also want to check out ...

• A bibliography reference manager known as JabRef (~5 MB) and runs on the Java VM (version 1.4.2 or greater).

• Ipe extensible drawing editor (~4.5 MB) - A drawing editor for creating figures in PDF or (encapsulated) Postscript format. It supports making small figures for inclusion into LaTeX-documents, i.e. native LaTeX text and equations in figure. It is also possible to import postscript figures (for example MATLAB plots) to Ipe using first `ps2pdf` (part of MikTeX) and then `pdftoipe` (part of IPE).

To get the icelandic fonts to work in IPE do the following: (1) Install "cm-super" (2) Select "Edit->Document properties" and add to the "Latex Preamble", the following lines:

```\usepackage[utf8]{inputenc}
\usepackage{ucs}
\usepackage[T1]{fontenc}
```
If you do not install "cm-super" you must select a font like
```\usepackage{palatino}
```

• LaTable is a WYSIWYG style editing program for LaTeX tables, useful when designing complicated tables.

## The LaTeX text editor/environment

1. ### The LaTeX editor GNU/Emacs + AucTeX, Ispell ...

A good working environment for MikTeX is GNU/Emacs. Here is an excellent description: http://www.math.aau.dk/~dethlef/Tips/introduction.html on how-to set it up! Includes syntax highlighting, macros, on-the-fly spelling, ... (everything!).

(A quick reference card for Emacs: EmacsRefcard.pdf.)

2. ### Texmaker

Texmaker: Free cross-platform LaTeX editor that integrates many tools needed to develop documents with LaTeX, in just one application.

3. ### A good WYSIWYG style editor is LyX (www.lyx.org)

This open source document processor is good for those who don't want to learn LaTeX: see http://wiki.lyx.org/Windows/Windows (simple to install, around 8MB)

## Installing the software

1. `Gs???w32.exe` and `Gsv??w32.exe` are self-extracting zip files, they automatically run setup, just follow the instructions on the screen.

2. You have downloaded one file called `setup.exe` run it and follow the instructions on the screen (I strongly recommend you setup MikTeX on the root of the hard disk).

3. Reboot the computer (if needed), and that's it!

To compile your LaTeX documents in a "DOS" window (`cmd` or `command`), use the line: `latex myfile.tex` (and ```dvips myfile.dvi```, `bibtex mybib.bib`, etc.). Or compile directly from your IDE, for example in GNU/Emacs use `<ctrl>-C-C` to compile.

## Macros and style files

• Adding Style files to the MikTeX distribution. Any extra style files (not in MikTeX) should be put in the directory: `\texmf\tex\latex\` (any sub-folder there, but only one folder depth). Then refresh the file name database in "MikTeX options".

## Creating a PDF document

Creating PDF files using dvipdfm (command: `dvipdfm myfile.dvi`)

Take a look at the "config" file for `dvipdfm` located under `\texmf\dvipdfm\config`. Make sure that for the "D" options the complete path is set for gswin32c, i.e. ``` % The following line works with GhostScript D "c:/progra~1/gs/gs8.00/bin/gswin32c -q -sPAPERSIZE=a0 -sDEVICE=pdfwrite -dCompatibilityLevel=1.2 -dUseFlateCompression=true -dNOPAUSE -sOutputFile=\"%o\" \"%i\" -c quit" ```
This is one line!

For those using different font encodings like: `\usepackage[T1]{fontenc}`. The PDF document may not display crisp fonts. To solve this try using different fonts, i.e. `\usepackage{palatino}` (take a look in the directory `\texmf\tex\latex\psnfss\*.sty` for additional fonts), OR simply install the font package `cm-super`.

You may have some troubles generating PDF files with `dvipdfm` when using PSFRAG. The workaround is to create the PDF directly from the PS file, i.e. Open file in "gsview", then choose `file-convert` (gsview-convert-snapshot.jpg) followed by `device-pdfwrite` (600 pt) (gsview-pdfwrite-snapshot.jpg). The command line version `ps2pdf` can also be used.

## Adding images to a LaTeX document

The most common way of adding figures to LaTeX is by including postscript files (see the demo file above for an example). You can create figures using the Ipe program mentioned above. Here is also a MATLAB m-file that converts most image formats to encapsulated postscript (better to use EPS because the bounding box is then as small as possible). The file may be downloaded here: im2eps (the file includes instructions of usage). Note you must have the image processing toolbox to use this file.

## Changing MATLAB figures to native LaTeX using PSFRAG

You need to download the PSFRAG macro package (it also includes a demo). Install this package in the folder: `\texmf\tex\latex\psfrag`. Installation is completed by running `latex psfrag.ins` in this folder and by copying the created file `psfrag.pro` to the folder `\texmf\dvips\base\`. Now take a look at this demo file (you will also need this encapsulated postscript file, the MATLAB figure, to compile the document). You should also definitely take a look at laprint.m by Linnemann for printing MATLAB figures (also based on PSFRAG but does all the work for you!).

## Icelandic dictionary

There is a dictionary for ispell (or here) available and one compiled for aspell-is by Elías.

## Icelandic language (using Babel with MikTeX or teTeX)

These files and procedures are now part of the MikTeX package, as of version 2.0. MikTeX now includes an "options dialog box" enabling you to select the language of your choice, just don't forget to hit the "update format files" button!

``` \usepackage[icelandic]{babel} \usepackage[T1]{fontenc} ```
(install the font package `cm-super`)

If you want to change between hyphens, say for example icelandic and english, then use
`\usepackage[english,icelandic]{babel}`
and then when switching between hyphens use
`\selectlanguage{icelandic}` or `\selectlanguage{english}`.

If you have an older version on MikTeX or teTeX (for Linux or MacOS), then you must do the following:

1. Copy files icelandic.ldf and icelandic.sty to the directory `\texmf\tex\generic\babel\`.
2. Add the line `\DeclareOption{icelandic}{\input{icelandic.ldf}}` to the file `\texmf\tex\generic\babel\babel.sty`.
3. Copy the file ishyph.tex to the directory `\texmf\tex\generic\hyphen\`
4. Add the line: `icelandic ishyph.tex` to the file `\texmf\tex\generic\config\language.dat` (you will see where when you open the file, you may want to comment out other languages such as french, etc.).
5. Run MikTeX -> Maintainer -> Reconfigure (close all tex related software first!).

If you are using teTeX for Linux or MacOS then the above instructions are the same (perhaps steps 1 and 2 have been done). You will find the texmf directory under `/usr/share/texmf`. Run `fmtutil --all` (but before doing so, run `texhash` first so it knows about the new files you added to the directories) to remake the formats (as root). If you have any trouble with teTeX try this hyphen file.