I am having problems using the showidx and hyperref together. If either package is removed, everything works as I would expect. If both packages are present, then the results are not what I expect, which is index entries shown in the margin and hyperlinks in the (correct) index. Minimal example:
Code: Select all
\documentclass[12pt]{article}
\usepackage{makeidx}
\usepackage{showidx}
\usepackage{hyperref}
\makeindex
\begin{document}
\section{The section}\index{Section}
\printindex
\end{document}
The problem is that in this example, the index entry is not shown in the margin and in the index itself the entry is wrong. A partial fix is to put the showidx package after the hyperref package
Code: Select all
\documentclass[12pt]{article}
\usepackage{makeidx}
\usepackage{hyperref}
\usepackage{showidx}
\makeindex
\begin{document}
\section{The section}\index{Section}
\printindex
\end{document}
which will cause the document to create the index correctly and the entry in the side margin, but without the hyperlink. To completely fix the problem the document needs to be compiled using
Code: Select all
\documentclass[12pt]{article}
\usepackage{makeidx}
\usepackage{hyperref}
%\usepackage{showidx}
\makeindex
\begin{document}
\section{The section}\index{Section}
\printindex
\end{document}
until the index has the hyperlinks, then uncomment the showidx package to get the index entries in the margin. This however is a nuisance, which leads to my questions:
1) Is there a way of using showidx and hyperref to get entries in the margin and hyperlinks without modifying the source code?
2) Why does the order of hyperref and showidx make a difference?