# hypertoc.sty

--

Decent Links in Tables of Contents1
Footnote 1: This document describes version v0.1 of hypertoc.sty as of 2011/01/23.

Uwe Luck1

Footnote 2: [http://contact-ednotes.sty.de.vu](http://contact-ednotes.sty.de.vu)

###### Abstract

hypertoc.sty changes macros for the table of contents so that colored frames to indicate links look acceptable. In the present version, this is achieved by inserting struts and only addresses LaTeX's standard article.cls.

###### Contents

* 1 Why
* 2 Usage
* 3 The Package File
* 4 VERSION HISTORY

## 1 Why

By default, the hyperref package highlights sectioning titles as printed in the table of contents (TOC) by red-framed boxes. It looks horrible, because of (_i_) the aggressive color and (_ii_) the irregular, "random" shapes of the boxes.

To avoid this, it seems to be standard to use hyperref's package option [colorlinks]. I don't like this either. It is confusing as to how the printed output will look like, the chosen color doesn't create a much more pleasant look; indeed, the publisher's graphical designer may have chosen colors for printing the table of contents--this design then is spoiled.

Therefore I prefer (_a_) choosing a more decent color and (_b_) using struts so that the boxes have a more regular shape.

In a publisher's package I even have found the idea to make a box for the entire TOC entry, including the page number. Then the frames look regular indeed, and you need less precision in moving the mouse for clicking at an entry. It would be nice if this could be integrated here later.

## 2 Usage

The file hypertoc.sty is provided ready, installation only requires putting it somewhere where TeX finds it (which may need updating the filename data base).1

Footnote 1: [http://www.tex.ac.uk/cgi-bin/texfaq2html?label=inst-wlcf](http://www.tex.ac.uk/cgi-bin/texfaq2html?label=inst-wlcf)

Below the \documentclass line(s) and above \begin{document}, you load hypertoc.sty (as usually) by

\usepackage{hypertoc}

This controls the _shapes_ of the frames. The _color_ must be chosen by the hyperref package option [linkbordercolor], I have used

\linkbordercolor={1\_.9\_.7},

--cf. makedoc.cfg.

## 3 The Package File

The package essentially has just _six_ code lines at present.

```
1\WeedsTeXFormat{LaTeX2e}[1994/12/01]
2\ProvidesPackage{hypertoc}[2011/01/23 v0.1 pretty TOC links (UL)]
3
4%%Copyright (C) 2011 Uwe Lueck,
5%%[http://www.contact-ednotes.sty.de.vu](http://www.contact-ednotes.sty.de.vu)
6%%--author-maintained in the sense of LPPL below --
7%%
8%%This file can be redistributed and/or modified under
9%%the terms of the LaTeX Project Public License; either
10%%version1.3c of the License, or any later version.
11%%The latest version of this license is in
12%%[http://www.later-project.org/lppl.txt](http://www.later-project.org/lppl.txt)
13%%We did our best to help you, but there is NO WARRANTY.
14%%
15%%Please report bugs, problems, and suggestions via
16%%
17%%[http://www.contact-ednotes.sty.de.vu](http://www.contact-ednotes.sty.de.vu)
18%%

Modifying \@dottedtocline}

\let\HTOC@@line\@dottedtoline
20\renewcommand*{\@dottedtoline}[4][%
21\HTOC@line{#1}{#2}{#3}{\mathstrut#4\mathstrut}} ```
\mathstrut is like \vphantom{()}, it indeed expands to \vphantom{()}( in LaTeX) (as in plain TeX).

Modifying \l@section:
22\let\HTOC@section\l@section
23\renewcommand*{\l@section}[1][%
24\HTOC@section{\mathstrut#1\mathstrut}}
```

Leaving:
25\endinput

## 4 Version History

``` v0.12011/01/23veryfirst