\index 位于 \pagenote 内。如何正确传播 pagenote 编号?

\index 位于 \pagenote 内。如何正确传播 pagenote 编号?

以下 MWE 取自\index inside 脚注:如何使用索引包正确传播脚注编号?并与包一起使用pagenote。索引结果显示:inside second pagenote, 2n0而不是inside second pagenote, 2n2。需要做什么来解决这个问题?

\documentclass{report}

\usepackage{index}
\usepackage{imakeidx}
\usepackage[hidelinks]{hyperref}
\usepackage[page]{pagenote}

\newcommand\pn[2]{\hyperpage{#2}n#1}

\makeatletter
\let\if@nopnote\iffalse % just for the example
\newcommand{\is}[1]{%
    \if@nopnote
    \index{#1}%
    \else
    \edef\tempnumber{\thepagenote}%
    \expandafter\pagenoteindex\expandafter{\tempnumber}{#1}%
    \fi
}
\makeatother
\newcommand{\pagenoteindex}[2]{\index{#2|pn{#1}}}

\makeindex
\makepagenote

\begin{document}
    
First\index{First index} sentence.\pagenote{First pagenote.}
    
Second sentence with index inside pagenote.\pagenote{Second pagenote with index.\is{inside second pagenote}}
    
Third sentence.\pagenote{Third pagenote.}
    
\printnotes
    
\printindex
    
\end{document}

编辑 1 - MWE

\documentclass{report}

\usepackage{index}
\usepackage{imakeidx}
\usepackage[hidelinks]{hyperref}
\usepackage[page]{pagenote}

\newcommand\pn[2]{\hyperpage{#2}n#1}

\makeatletter
\let\if@nopnote\iffalse % just for the example
\newcommand{\is}[1]{%
    \if@nopnote
    \index{#1}%
    \else
    \expandafter\pagenoteindex\expandafter{\tempnumber}{#1}%
    \fi
}
\renewcommand{\notenuminnotes}[1]{%
    \edef\tempnumber{#1}%
    {\normalfont #1.} }
\makeatother
\newcommand{\pagenoteindex}[2]{\index{#2|pn{#1}}}

\makeindex[program=xindy]
\makepagenote

\begin{document}

First\index{First index} sentence.\pagenote{First pagenote.}
\clearpage

Second sentence\index{sentence@\emph{sentence}} with index inside pagenote.\pagenote{Second pagenote with index.\is{inside second pagenote}}

\clearpage
Third sentence.\pagenote{Third pagenote.\is{sentence@\emph{sentence}}}

\printnotes

\printindex

\end{document}

使用 时,“句子”的索引条目缺少页码\makeindex[program=xindy],这是不正确的。但使用\makeindexonly 时,索引列表中会出现重复的“句子”条目,这也是不正确的。如何修复此问题?

编辑 2-带有 pagenote 的多重索引?!

有谁知道如何完成这项任务,例如多个索引

\makeindex[name=things,title=Things,program=xindy]
\makeindex[name=names,title=Names,program=xindy]

我认为这个方案pagenote需要进步和发展。MWE 可以是:

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{comment}
\usepackage{index}
\usepackage{hyperref}
\usepackage{imakeidx}
\usepackage[page]{pagenote}

\newcommand\pn[2]{\hyperpage{#2}n#1}
\newcommand{\pagenoteindex}[3]{\index[#1]{#3|pn{#2}}}
\makeatletter
\let\if@nopnote\iffalse
\newcommand{\is}[2]{%
    \if@nopnote
    \index[#1]{#2}%
    \else
    \expandafter\pagenoteindex\expandafter{\tempnumber}{#2}%
    \fi
}
\renewcommand{\notenuminnotes}[1]{%
    \edef\tempnumber{#1}%
    {\normalfont #1.} }
\makeatother

\makeindex[program=xindy,title=Things,name=Things]
\makeindex[program=xindy,title=Names,name=Names]
\makepagenote

\begin{document}
    
WordOne\pagenote{WordOnePagenote-\is[Things]{WordOnePagenoteThings}}

WordTwoThings\index[Things]{WordTwoThings}

WordThree\pagenote{WordThreePagenote-\is[Names]{WordThreePagenoteNames}}

WordFourNames\index[Names]{WordFourNamenregister}

\printnotes

\printindex[Things]
\printindex[Names]

\end{document}
````
Thank you for attention and solutions.

相关内容