The following MWE is taken from \index inside footnote: How to propagate the footnote number correctly with index package? and used with the pagenote package. The index result shows: inside second pagenote, 2n0 instead of inside second pagenote, 2n2. What needs to be done to solve this problem?
\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}
EDIT 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}
The index entry for "sentence" lacks the pagenumber when using \makeindex[program=xindy], which is incorrect.
But with \makeindex only, there are double entries of "sentence" in the index list, which is incorrect too.
How can this be fixed?
EDIT 2 - Multiple Index with pagenote?!
Is there anyone knowing how to do this task also for multiple indexing like
\makeindex[name=things,title=Things,program=xindy]
\makeindex[name=names,title=Names,program=xindy]
I think the package pagenote needs here progression and development.
A MWE could be:
\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.
</code></pre>
\thepagenotereturns0inside the\pagenote{}so that's the value you get when you write it, expanded, to the.idx. – cfr Dec 01 '23 at 02:11\pn2 arguments? Does it pick up the other automatically? – cfr Dec 07 '23 at 01:55\emph{}indexing within\pagenote{}works correctly. And earlier\makeindex[program=xindy]solved this problem. I have no idea how a second argument can be placed. – Thomkrates Dec 07 '23 at 21:55