I have code for creating an index that refers readers to a page number and an example number. (The code is included in this answer, reproduced below for convenience. I happen to be using expex
, but it could just as well be an equation number, for example.) I would like to use hyperref
to generate links to the specific example, rather than just the page. Is there a way to do this? I am using xindy
as an index processor.
\documentclass{book}
\usepackage{expex,lipsum,index}
\newcommand{\PageExample}{\thepage-\the\excnt}
\newindex[PageExample]{my-index}{idx}{ind}{My Custom Index}
\makeindex
\begin{document}
\ex \lipsum[1]\index[my-index]{First example} \xe
\ex \lipsum[2] \index[my-index]{Second example}\xe
\ex \lipsum[3] \index[my-index]{Third example}\xe
\ex \lipsum[4] \index[my-index]{Fourth example}\xe
\ex \lipsum[5] \index[my-index]{Fifth example}\xe
\ex \lipsum[6] \index[my-index]{Sixth example}\xe
\ex \lipsum[6] \index[my-index]{Seventh example}\xe
\printindex[my-index]
\end{document}