I want my index to show those items appearing within a footnote as page-number plus the footnote symbol, for instance, 137n7
for something in footnote 7 on page 137. Following https://tex.stackexchange.com/a/55460/3935, I use a special indexing command within footnotes that works correctly when the .idx
file is processed with MakeIndex. The command depends on the meaning (special to MakeIndex) of a pipe within an \index
command, to modify the page number of an indexed item.
But I am processing my index with texindy
, not MakeIndex, for foreign-language support, and with texindy
those special index entries are ignored. The xindy
man page explains:
For raw index entries in LaTeX syntax,
\index{aaa|bbb}
is interpreted differently. For MakeIndexbbb
is markup that is output as a LaTeX tag for this page number. Forxindy
, this is a location attribute, an abstract identifier that will be later associated with markup that should be output for that attribute.
I do not understand how to handle xindy
location attributes to get the original effect. It seems to me that because \footnote
has to be appended, this is not simple markup that can be done outside of the original to-be-indexed file itself. Xindy markup syntax is described here on the Xindy documentation site.
MWE:
%!TEX encoding = UTF-8 Unicode
\documentclass[12pt]{scrbook}
\usepackage{makeidx}
\makeindex
\newcommand{\pageandfn}[2]{#2n#1} % format as <page>n<footnotemark>
\newcommand{\indexfn}[1]{\index{#1@ #1|pageandfn{\thefootnote}}}
\begin{document}
Some text here.%
\footnote{Plain footnote\index{footnote, \texttt{\textbackslash index}}.} %
More text here.\footnote{%
Specially indexed footnote\indexfn{footnote, \texttt{\textbackslash indexfn}}.
}
\printindex
\end{document}
Text after compiling once:
Here are the contents of the .idx
file:
\indexentry{footnote, \texttt {\textbackslash index}}{1}
\indexentry{footnote, \texttt {\textbackslash indexfn}@ footnote, \texttt {\textbackslash indexfn}|pageandfn{2}}{1}
Processed with MakeIndex and then compiled again:
Processed with texindy
and then compiled again: