
주석 처리된 행이 그 위의 행으로 대체되면 색인이 설정되지 않습니다. 왜 안 돼?
\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