「enotez」パッケージで文末脚注を参照すると、間違った注釈が示される

「enotez」パッケージで文末脚注を参照すると、間違った注釈が示される

以前、パッケージ\footrefのコマンドを使用してfootmisc文末脚注を参照しました。これはendnotesパッケージと組み合わせて問題なく動作しました。

\documentclass{article}
\usepackage{footmisc,endnotes}
    \renewcommand{\footnote}{\endnote}
\begin{document}
\noindent Here is some text.\footnote{And here is an endnote.\label{foot.first}}\\
Here is more text.\footnote{And here is another endnote.\label{foot.second}}\\
Here is my final sentence.\footref{foot.first}\textsuperscript{,}\footref{foot.second}
\theendnotes
\end{document}

ここに画像の説明を入力してください

しかし、パッケージに切り替えたところenotez、これは正しく機能しなくなりました。以下の MWE では、最初のエンドノートへの参照が、2 番目のエンドノートを参照するようになっています。

\documentclass{article}
\usepackage{footmisc,enotez}
    \renewcommand{\footnote}{\endnote}
\begin{document}
\noindent Here is some text.\footnote{And here is an endnote.\label{foot.first}}\\
Here is more text.\footnote{And here is another endnote.\label{foot.second}}\\
Here is my final sentence.\footref{foot.first}\textsuperscript{,}\footref{foot.second}
\printendnotes
\end{document}

ここに画像の説明を入力してください

enotez正しい文末脚注を参照するにはどうすればよいでしょうか?

答え1

enotezコマンドは\label文末脚注テキストの外側に配置する必要があります。セクション 3.1 の最後の例を参照してください。

機能付きのコマンドfootmiscを定義できるので、必要ありません。\footrefenotez

\documentclass{article}
\usepackage{enotez}

\renewcommand{\footnote}{\endnote}
\newcommand{\footref}[1]{%
  \enotezwritemark{\enmarkstyle\ref{#1}}%
}

\begin{document}

\noindent Here is some text.\footnote{And here is an endnote.}\label{foot.first}\\
Here is more text.\footnote{And here is another endnote.}\label{foot.second}\\
Here is my final sentence.\footref{foot.first}\textsuperscript{,}\footref{foot.second}
\printendnotes
\end{document}

ここに画像の説明を入力してください

multiple のインスタンスが複数ある場合は\footref、省略構文を検討できます。

\documentclass{article}
\usepackage{enotez}

\renewcommand{\footnote}{\endnote}

\ExplSyntaxOn
\NewDocumentCommand{\footref}{m}
 {
  \sverre_footref:n { #1 }
 }

\seq_new:N \l_sverre_footrefs_seq

\cs_new_protected:Npn \sverre_footref:n #1
 {
  \seq_clear:N \l_sverre_footrefs_seq
  \clist_map_inline:nn { #1 }
   {
    \seq_put_right:Nn \l_sverre_footrefs_seq
     { \enotezwritemark{\enmarkstyle\ref{##1}} }
   }
   \seq_use:Nn \l_sverre_footrefs_seq { \textsuperscript{,} }
 }
\ExplSyntaxOff

\begin{document}

\noindent Here is some text.\footnote{And here is an endnote.}\label{foot.first}\\
Here is more text.\footnote{And here is another endnote.}\label{foot.second}\\
Here is my final sentence.\footref{foot.first,foot.second}
\printendnotes
\end{document}

答え2

または (2022 年以降)、postnotes代わりに を使用してください。これは、\label{...}典型的/論理的な方法で動作し、パッケージにはさらに相互参照機能があり、便利かもしれません。マニュアルから引用します:

ポストノートとの相互参照は、ラベルを設定して、それを参照するという、かなり標準的な方法で機能します。ただし、ラベルをノートに設定する方法は 2 つあります。labelのオプションを使用してラベルを設定する\postnoteか、ノートのコンテンツの一部として標準を使用して直接設定するかのいずれか \labelです。どちらも有効ですが、同等ではなく、意味が異なり、それに応じて動作が異なります。 [¶] オプションを使用して設定されたラベルは、labelの場所に設定されます\postnote。ノートのコンテンツ内で で設定されたラベルは\label、単に保存され、この 13コンテンツがタイプセットされるときにのみ、 で展開されます\printpostnotes。つまり、labelオプションは「マーク」に属し、\labelコンテンツ内で設定されたラベルは「テキスト」に属します。

\documentclass{article}
\usepackage{footmisc,postnotes}
\renewcommand{\footnote}{\postnote}
\begin{document}
\noindent Here is some text.\footnote{And here is an endnote.\label{foot.first}}\\
Here is more text.\footnote{And here is another endnote.\label{foot.second}}\\
Here is my final sentence.\footref{foot.first}\textsuperscript{,}\footref{foot.second}
\printpostnotes
\end{document}

関連情報