[pdftex] Hyperref links to Index headings -- what am I missing?

Heiko Oberdiek oberdiek at uni-freiburg.de
Thu Sep 25 22:34:32 CEST 2003


On Thu, Sep 25, 2003 at 04:22:42PM +0300, Elisabeth Baker wrote:

> Since the index is so large, and is housed in a volume of its own (shared
> with glossaries and bibliography),
> and since these volumes are for on-line use,
> I hope to put a line across the bottom margin or along the right-hand
> margin, saying:
> 
>  Symbols A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
> 
> such that the word "Symbols" and each letter are hyperlinked to the
> corresponding Heading in the Index chapter of the Index volume.
> 
> The LaTeX I use to create this alphabet line of links (for testing)
> currently says:
> 
>      \newcommand{\newindexmarginmark}[1]{%
>        \href{file:APP\#{#1}}{\textbf{#1}}%
>        }%
> 
>      \newindexmarginmark{A}
>      \newindexmarginmark{B}
>      \newindexmarginmark{C}
>      ...
> 
> So far, in my manualidx.ist, I have 
> 
>      heading_prefix "\\IndexHeading{"
>      heading_suffix "}\\nopagebreak\n\\indexspace\n"
> 
> In a style file, I define \IndexHeading...
> 
>      \newcommand{\IndexHeading}[1]{%
>      	\BF{\Large{#1}}%
>      %	\label{#1}%
>      }
> 
> I can design the thing visually, but I can't seem to figure out how to make
> these links.  At this point, with the LaTeX written as shown above, all the
> links lead to the front cover of the Index volume.

\documentclass{article}
\usepackage{makeidx}
\makeindex
\usepackage{hyperref}
\newcounter{idx}
\newcommand*{\IndexHeading}[1]{%
  \renewcommand*{\theidx}{#1}% counter appearance
  \renewcommand*{\theHidx}{idx.#1}% link name
  \refstepcounter{idx}%
  \label{idx:#1}%
  \textbf{\Large #1}%
}

\begin{document}
\section{Hello World}
\index{Hello}
\index{World}
Index: \ref{idx:H}, \ref{idx:W}
\newpage
\printindex
\end{document}

If the index is in a separate file, the link can be done either by
the help of package xr or with the link names:
  \href{index.pdf#idx.H}{\textbf{H}}

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>
-- 


More information about the pdftex mailing list