
Ранее я использовал \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}