I want to make the indexed words into hyperlinks to the entries in the "Index" (something similar to the glossaries package).
I'm using xindy on TL2012 and here is my code:
\documentclass{article}
\usepackage{makeidx}
\makeindex
\usepackage{hyperref}
\begin{document}
Lorem\index{Alpha} ipsum dolor sit amet, consectetur\index{alpha}
adipiscing elit. Proin ullamcorper\index{gnat} quam magna, quis
convallis\index{gnus!good} sapien. Donecat ligula vel dolor
varius\index{bites!vegetable} lobortis id ut orci\index{gnat!size
of}. Maecenas commodo fringilla elit\index{Alphabet}, et pellentesque
purus ornare vitae. Aenean non metus ipsum. Lorem\index{gnat!anatomy}
ipsum dolor sit amet, consectetur adipiscing\index{alphas} elit. Ut
mauris lorem, accumsan a sagittis ut, rutrum fringilla arcu. Cras
ullamcorper faucibus\index{alpha bet} quam id molestie.
\printindex
\end{document}
How can I do that?
\indexcommand as below? \let\oldindex\index \renewcommand*{\index}[1]{\oldindex{#1@\hypertarget{#1.ind}{}#1}\href{##1.ind}{#1}} – Vahid Damanafshan Nov 10 '12 at 17:17
\protect\hypertarget, otherwise it will break:\let\oldindex\index \renewcommand*{\index}[1]{\oldindex{#1@\protect\hypertarget{#1.ind}{}#1}\href{\##1.ind}{#1}}. This redefinition is practical, but it does not work for index entries with subentries, e.g.\index{gnus!good}. Either use\oldindex{gnus!good@\hypertarget{gnusgood.ind}{}good}\href{\#gnusgood.ind}{good}or feel free to ask a follow-up-question about how to achieve that. – Stephen Nov 10 '12 at 19:14\protect, the link to the entry in the Index doesn't work! – Vahid Damanafshan Nov 10 '12 at 19:54xindythis worked for me, and at the moment I have no idea how to fix it. Because neither index entries with subentries could be used this way, imho it would be appropriate to ask a follow up question "Why does\let\oldindex...not work?". – Stephen Nov 10 '12 at 20:16