
我之前使用過包\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 中,對第一個尾註的引用是指第二個尾註。
\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{...}
以典型/邏輯方式工作,並且該套件具有您可能喜歡的進一步交叉引用功能。引用手冊:
與後記的交叉引用以非常標準的方式工作:設定標籤,對其進行引用。但是,有兩種方法可以為註釋設定標籤。您可以使用
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}