在我的 MWO 中teubner.sty
,无论它在何处以及如何加载,都会splitindex
在文件中插入任意空格.idx
(见下文)。
至少在这个示例中,如果我\index
用替换\oldindex
,它是有效的,这是LetLtxMacro
应该做的---但实际上并没有这样做。
在我的另一份文档中,.idx
带有空格的条目不会被省略,但即使内容相同,其处理方式也与无空格的条目不同。
在示例中,我包含了我需要的所有包以及可能干扰索引的包。
% Index-spaces.tex
% -*- mode: latex; TeX-engine: xetex; coding: utf-8; -*-
\RequirePackage{xparse}
\documentclass{scrartcl}
\usepackage{savesym}
\usepackage[main=ngerman,greek.polytonic]{babel}
\usepackage{letltxmacro}
\usepackage{teubner} % <-- seems to be the troublemaker
\savesymbol{breve} % <-- used by another package
% \let\breve\relax
\usepackage[twothirds]{thinsp}
\usepackage[splitindex,xindy]{imakeidx}
\makeindex[name=fpl,title={Fontes Platonici},program=xindy]
\makeindex[name=fan,title={Fontes Antiqui},program=xindy] % fontes
% antiqui
\usepackage[xindy]{reledmac}
\usepackage[no-sscript]{xltxtra}
\savesymbol{breve}
% \let\breve\relax
%%%------it doesn't matter at which point teubner is loaded-------
% \let\breve\relax
% \usepackage{teubner}
% teubner.sty seems to cause trouble
% \savesymbol{breve}
%%%---------------------------------------------------------------
\usepackage{idxlayout}
\makeatletter
\LetLtxMacro\oldindex\index
\RenewDocumentCommand\index{o m}{%
\IfNoValueTF{#1}%
{\oldindex{#2}\ignorespaces}%
{\oldindex[#1]{#2}\ignorespaces}%
}
\NewDocumentCommand\innote{m}{#1\textit{n}}
\NewDocumentCommand\nindex{m}{\orig@@index{#1|innote}} % for
% compatibility with reledmac
\makeatother
\begin{document}
\section{Lorem}%
\label{sec:Lorem}%
\index[fpl]{Index@\emph{Inx.}!178a@178|(}%
ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, %
\index[fan]{Hesiod!NotIndex@\emph{NoIx.}!0116@116\,f.}
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. %
\index[fan]{Hesiod!YesIndex@\emph{YesIx.}!0120@120}%
Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices.
\newpage %
\index[fpl]{OutOfIndex@\emph{OutIx}!177b@177b\,f.}%
Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien es iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices %
\index[fpl]{Index@\emph{Inx.}!178a@178|)}%
bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan
\newpage
eleifend, %
\index[fpl]{Index@\emph{Inx.}!178a@178\,a}
sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.
\printindex[fpl]
\printindex[fan]
\end{document}
来自 Index-spaces-fan.idx
\indexentry{Hesiod!NotIndex@\emph {NoIx.}!0116@116\penalty \@M \hskip 0.07emf.}{1}
\indexentry{Hesiod!YesIndex@\emph {YesIx.}!0120@120}{1}
!YesIndex
pdf 上仅出现第二条条目( )。