
コメントアウトされた行がその上の行に置き換えられると、インデックスは設定されません。なぜでしょうか?
\documentclass{article}
\usepackage{imakeidx}
\usepackage{hyperref}
\usepackage{letltxmacro}
\def\fn#1#2{%
\hyperpage{#2} n.\,#1%
}%
\LetLtxMacro{\oldindex}{\index}
\newcommand{\is}[1]{%
\if@noftnote%
\index{#1}%
%\oldindex{#1}%
\else%
\index{#1|fn{\number\value{footnote}}}%
%\oldindex{#1|fn{\number\value{footnote}}}%
\fi%
}
\makeindex
\begin{document}
Cheese.\footnote{\is{cake}cake.}
\printindex
\end{document}
答え1
\LetLtxMacro
する期待通りに動作する。\oldindex
の意味は\index
割り当て時特にこれは前に \makeindex
ここで、LaTeX は\index
アクションなしのダミーとしてのみ機能します。\makeindex
を再定義して\index
、ファイルにエントリを書き込みます.idx
。
修正:
\makeindex % redefines \index
\LetLtxMacro\oldindex\index