Hello:
I have the following problem: I am using the makeidx and hyperref packages
\usepackage{makeidx}
\usepackage[dvips,colorlinks=true]{hyperref}
In the text I have stuff like:
\index{AB_Multipole}
\index{AB_Multipole|textbf}
The .ind file that is created then looks like:
\item AB_Multipole, \hyperpage{25}, \textbf{56}
So I do not get a hyperlink for page 56. What is the best way of fixing this?
Thanks, David
Document Classes ⇒ Hyperref with index problem
-
- Posts: 3
- Joined: Thu Oct 30, 2008 4:00 am
Re: Hyperref with index problem
Here is a simple example that can be run.
\documentclass{book}
\usepackage{makeidx}
\usepackage{hyperref}
\makeindex
\begin{document}
\chapter{A}
\index{this}
\chapter{B}
\index{this|textbf}
\printindex
\end{document}
Assuming that the above are in a file test.tex here are the commands to generate the test.ind file:
latex test
makeindex test
\documentclass{book}
\usepackage{makeidx}
\usepackage{hyperref}
\makeindex
\begin{document}
\chapter{A}
\index{this}
\chapter{B}
\index{this|textbf}
\printindex
\end{document}
Assuming that the above are in a file test.tex here are the commands to generate the test.ind file:
latex test
makeindex test
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Hyperref with index problem
Try the following. At first define a new command.
Then use this when marking an index entry.
The page number of this entry now appears bold faced and the links should be correct.
Best regards and welcome to the board
Thorsten¹
Code: Select all
\newcommand{\bb}[1]{\textbf{#1}}
Code: Select all
\index{this|bb}
Best regards and welcome to the board
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 3
- Joined: Thu Oct 30, 2008 4:00 am
Hyperref with index problem
Thanks for the tip. This does not quite do it. What is needed is:
Is this a bug that needs to be reported?
Cheers David
Code: Select all
\newcommand{\bb}[1]{\textbf{\hyperpage{#1}}}
Cheers David
localghost wrote:Try the following. At first define a new command.Then use this when marking an index entry.Code: Select all
\newcommand{\bb}[1]{\textbf{#1}}The page number of this entry now appears bold faced and the links should be correct.Code: Select all
\index{this|bb}
Best regards and welcome to the board
Thorsten¹
Hyperref with index problem
No, it is a well known fact. From the documentation of the hyperref code[1]:DavidSagan wrote:What is needed is:Is this a bug that needs to be reported?Code: Select all
\newcommand{\bb}[1]{\textbf{\hyperpage{#1}}}
[1] Sebastian Rahtz, Heiko Oberdiek: Hypertext marks in LATEX, p. 145. To get this document, search it on CTAN or simply, if you use TeX Live, open a console and typeHyper-indexing works crudely, by forcing code onto the end of the index entry with
the | feature; this puts a hyperlink around the printed page numbers. It will not proceed if
the author has already used the | specifier for something like emboldening entries. That
would make Makeindex fail (cannot have two | specifiers). The solution is for the author
to use generic coding, and put in the requisite \hyperpage in his/her own macros along
with the boldness.
texdoc hyperref
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.