
以前、パッケージ\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
を定義できるので、必要ありません。\footref
enotez
\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}