I have a question similar to this question: I'm using makeidx and I want the index to use a different counter than \thepage. My code looks like this:
\documentclass{scrbook}
\usepackage{makeidx}
\usepackage{xpatch}
\makeindex
\newcounter{NewCounter}
\setcounter{NewCounter}{5}
\makeatletter % the macro name contains @
\xpatchcmd{\@wrindex}{%
\indexentry{#2}{\thepage}%
}{%
\indexentry{#2}{\NewCounter}%
}
{}{}% <success> and <failure> code not needed
\makeatother
\begin{document}
\stepcounter{NewCounter}\chapter{Test}\index{Test}
\arabic{NewCounter}
\printindex
\end{document}
So, unfortunately after compilation with lualatex and makeindex
the entry "Test" has the pagenumber (1) instead of the NewCounter (6) in the index. Any help with the usage of xpatchcmd? Thanks in advance.