Indextools 包和自定义索引。(部分和任何计数器)

Indextools 包和自定义索引。(部分和任何计数器)

我的问题是我需要创建一个自定义索引,显示的内容不只是页面。像这样:Word,s.5,o.6,p.9,其中 s. 是部分,o. 是虚拟计数器,p. 是页面。

我的 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}

我使用 indextools 是因为我需要兼容bidi。我尝试调整答案这里,但没有作用...我确实需要使用 xindy 和 splitindex 选项。

相关内容