Background
Looking to indent an arbitrary n-level hierarchy within an index and have hyperlinks for the final item, using the memoir class and pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012).
For example:
\index[classification]{Anthropoidea!Hominoidea!Hominidae!Homo!sapiens}
Should produce:
Where the 2 in "sapiens, 2" is hyperlinked back in the document (PDF).
Problem
First, makeindex
can only nest 3-levels deep. Second, xindy
is incompatible with hyperref; from the man page:
In particular, this means that by default the LaTeX package "hyperref" will create raw index files that cannot be processed with xindy. This is not a bug, this is the unfortunate result of an intented [sic] incompatibility. It is currently not possible to get both hyperref's index links and use xindy.
Question
How would you create hyperlinked indexes that nest to an arbitrary depth?
Example Document
A minimal document might resemble:
\documentclass{memoir}
\usepackage{filecontents}
\begin{filecontents*}{style1.xdy}
(markup-index :open "~n\begin{theindex}~n"
:close "~n\end{theindex}~n"
:tree)
(markup-indexentry :open "~n \sssssubitem " :depth 5)
\end{filecontents*}
\long\def\lettergroup#1\item{\item\textbf}
\let\lettergroupDefault\lettergroup
\usepackage{makeidx}
\makeindex
\begin{document}
Start
\index{Anthropoidea!Hominoidea!Hominidae!Homo!sapiens}
End
\printindex
\end{document}
However, this does not produce the correct results, when run with:
pdflatex file.tex; texindy file.idx; pdflatex file.tex
Best Answer
You can use
hyperref
macro\hyperpage
to link to the indexed page. Withyou tell xindy to enclose page numbers with this macro.
For more hierarchical levels, you can use
and define macros like
\sssubitem
:Compile with
You must tell
texindy
to use the module with-M
option.The result: