1

My problem is that I need to create a custom index that shows more than the page. Like this: Word, s.5,o.6,p.9 , where s. is section, o. a dummy counter, and p. page.

My MWE:

\documentclass{book}
\usepackage{showidx}
\usepackage[splitindex,xindy]{indextools}
\usepackage{blindtext}
\usepackage{fontspec}



%\makeindex[options=-M sectionindex_sectionpage.xdy]
%\makeindex[name=foo,title=Test,options=-M sectionindex_sectionpage.xdy]

\makeindex[options=-M module.xdy]
\makeindex[name=foo,title=Test,options=-M module.xdy]

%\makeatletter
% Global redefinition of indexentry to use section, then page%
%\renewcommand{\imki@wrindexentrysplit}[3]{%
% \expandafter\protected@write\csname#1@idxfile%\endcsname{}%
  %  {\string\indexentry{#2}{s\arabic{section},o
 %\arabic{onet},p\thepage}}%
%}%
%\makeatother



\makeatletter
\def\indtl@wrindexsplit#1#2{%
\indtl@wrindexentrysplit{#1}{#2}{s\arabic{section},o\arabic{onet},p\thepage}%
\endgroup\indtl@showidxentry{#1}{#2}%
\@esphack%
}
\makeatother

\makeatletter
\def\indtl@wrindexunique#1#2{%
\indtl@wrindexentryunique{#1}{#2}{s\arabic{section},o\arabic{onet},p\thepage}%
\endgroup\indtl@showidxentry{#1}{#2}%
\@esphack%
}
\makeatother

\begin{filecontents*}{module.xdy}
( define-location-class "module"
                        ("alpha" :sep "" "arabic-numbers" :sep "," "alpha" :sep "" "arabic-numbers" ))
\end{filecontents*}

\newcounter{onet}


\begin{document}
\section{1}
\refstepcounter{onet}
Test1\index{Test1}
\refstepcounter{onet}
Test2\index[foo]{Test2}
\newpage
\section{1}
\refstepcounter{onet}
Test3\index{Test3}
\refstepcounter{onet}
 Tset\index{Test3!γλῶσσα}
 \refstepcounter{onet}
Test4\index[foo]{Test4}


\printindex

\printindex[foo]
\end{document}

I use indextools because I need compatibility with bidi. I tried to adapt the answer here, but did not work... I really need to use xindy and splitindex options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.