重复索引条目

重复索引条目

我刚开始尝试索引,但还不是很成功。我得到了很多重复的条目,我想是因为连字符。请参见下面的示例,它是我根据真实文件的 grep 创建的,其中,对于“Artha-śāstra”,我特别确保我选择了第一次出现的条目并将其复制到后面的条目上,该文件由两位作者编写,理论上可能使用不同的 unicode 字符进行变音组合。查看文件idx似乎在实际使用自由连字符的两个实例中,它被扩展为\indexentry{Artha\discretionary {-}{}{}śāstra@\textit {Artha\discretionary {-}{}{}śāstra}}{1},而在其他情况下它只是\indexentry{Artha\-śāstra@\textit {Artha\-śāstra}}{1}。但也许是别的原因。

\documentclass{article}
\usepackage{fontspec}
\usepackage{makeidx}
\makeindex
\newcommand{\ttl}[1]{{\textit{#1}\index{#1@\textit{#1}}}}
\newcommand{\skt}[1]{{\textit{#1}}}
\begin{document}
Beginning at the top of the first passage, the first thing we shall comment on is the prevalence of magical pills in early tantric literature.  These appear to be absent in the \ttl{Atharva\-veda\-pariśiṣṭa}, but we find the preparation of pills for making others fall unconscious in the mantra and \skt{prayoga} given in \ttl{Artha\-śāstra} 14.3.19ff.  To call them pills, however, is potentially confusing, since in our tantric sources they are clearly to be popped into the \skt{sādhaka}’s mouth and held there, not swallowed, and they enable the \skt{sādhaka} to obtain powers. 
\footnote{This is of course not something that develops for the first time in tantric sources: the \ttl{Artha\-śāstra} uses the magical power of the cremation ground in 14.3.29, 14.3.32 and 14.3.49.  We may note however that it refers to it with the expression \skt{asaṃkīrṇa ādahane}, ‘in an unfrequented burning ground’.  Tantric sources never, as far as we are aware, use this expression: they refer instead to the \skt{śmaśāna}.}
in \ttl{Atharva\-veda\-pari\-śiṣṭa} 36.21.1 and the fourteenth day of the dark fortnight (never the eighth) is specified for several of the magical \skt{prayoga}\/s given in the \ttl{Artha\-śāstra}.%
\footnote{\ttl{Artha\-śāstra} 14.3.28, 14.3.41, 14.3.49, 14.3.58, 14.3. 69, 14.3.70, 14.3.85.  The fourteenth day is recommended for summoning the ancestors (\skt{pitṛ}) in order to satisfy them in \ttl{Atharva\-veda\-pari\-śiṣṭa} 43.6.1.}  
in the \ttl{Artha\-śāstra} 4.5.7, and in \ttl{Aṣṭādhyāyī} 4.3.72.%
Probably widespread throughout the world is the use of effigies for damaging, destroying or gaining power over other people by a form of sympathetic magic in which whatever is done to the doll is held to be effected on the person represented.  It is therefore no surprise to find them in, for example, the \ttl{Artha\-śāstra} (14.3.69–72):
\ttl{Rāmāyaṇa} 5.46.38, 6.45.22; \ttl{Artha\-śāstra} 1.19.11ab, 14.3.31, 14.3.45ab, 14.3.58; \ttl{Mahābhārata} 3.274.25, 7.58.9, 7.121.30, etc. 
\printindex
\end{document}

指数

更新:

ind当我使用 生成文件时,出现了上述问题makeindex duplicates.idx。与此同时,我发现当我使用以下命令生成该文件时,相同的文件可以正常生成,没有重复项:xindy -M texindy duplicates.idx,因此问题对我来说已经解决了。但奇怪的是,texindy duplicates.idx我原本以为 会做同样的事情,同时处理不同的自由连字符,却无法避免脚注中包含自由连字符的单词出现重复。

答案1

正如您所猜测的,条目\-中的 肯定是导致多次列出的原因。

正如您所观察到的,在.idx文件中,一些条目包含字符串\discretionary {-}{}{}。这些是在脚注中输入的条目,这是由处理脚注时发生的扩展引起的。

如果您可以避免将索引条目放在脚注中,而是将它们输入到脚注之前,您应该会获得更好的结果。

同样的事情也会发生在章节标题或标题中的此类索引条目上,任何处于“移动参数”(即保存以供以后在不同位置重用)的地方。虽然的参数\index可以被视为移动参数,但它会得到特殊处理 - 但只有在它出现的上下文经过其他处理之后。

答案2

ind当我使用以下命令生成文件时,相同的文件不会出现重复: xindy -M texindy duplicates.idx。奇怪的是,texindy duplicates.idx虽然处理了不同的自由连字符,但无法避免脚注中包含自由连字符的单词出现重复。

相关内容