Next: 5 Linking to an External URL   Previous: 3 Practical Problems

# 4 Document Preamble

In the next sections we focus on the DVIPDFM / JPEG route, beginning with a discussion of the packages and options appropriate to the preamble of the document. Once again we refer the reader to example.tex.

## Documentclass

It is a good idea to include a `dvipfdm` in the `\documentclass` command. For example, in example.tex the first line is:
```\documentclass[12pt,a4paper,dvipdfm]{article}
```

## Graphicx Package

To include our graphics we need the `graphicx` package. It seems that the `dvips` option is useful here. In example.tex the declaration is:
```\usepackage[dvips]{graphicx}
```

## Color Package

We want to have colour hyperlinks, etc., and so we need:
```\usepackage[usenames,dvipsnames]{color}
```
I can't remember the justification for the `usenames` and `dvipsnames` options; it may even be that they can be removed. But in any case, in the world of LATEX, the only justification for things is that they work!

## HTML and Hyperref Packages

### Basic Declarations

That both `HTML` and `hyperref` are required is a subtlety, as there is some duplication of functionality: for example, both packages provide commands to do hyperlinks. However we will actually use the `html` package for hyperlinks, and the `hyperref` package to link the LATEX document structure into the PDF file as bookmarks and to do other similar things. The relevant declarations are:
```\usepackage{html}
\usepackage[dvipdfm]{hyperref}
```
Note that it may be important that `hyperref` is the last package to be declared; alternatively, this may just be mythology.

### Other Options

The `dvipdfm` option for `hyperref` is always a good idea, but there are also a number of more optional options; they cover things like the generation of bookmarks in the Adobe / PDF document, the colour of hyperlinks, and the PDF document information such as the name of the author, etc. We will discuss these options in detail in Section 7.

### Cautions

Note that, as was mentioned in Section 3.1, the `hyperref` package conflicts with LATEX2HTML's ability to do numbering properly. It is therefore a good idea to use no commands from the `hyperref` package so that only the `\usepackage` line need be commented out before running LATEX2HTML.

 © Charles Clayton 2000. Please use this information at your own risk.