
Anteriormente usé el \footref
comando del footmisc
paquete para hacer referencia a una nota final. Esto ha funcionado bien en combinación con el endnotes
paquete:
\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}
Pero ahora cambié al enotez
paquete y ya no funciona correctamente. En el MWE siguiente, la referencia a la primera nota al final se refiere en cambio a la segunda nota al final.
\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}
¿Cómo puedo hacer enotez
referencia a la nota final correcta?
Respuesta1
El enotez
comando \label
debe estar fuera del texto de la nota final; consulte el ejemplo final en la sección 3.1.
No es necesario footmisc
, ya que puede definir un \footref
comando con enotez
características:
\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}
Si tiene varias instancias de multiple \footref
, puede considerar una sintaxis abreviada:
\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}
Respuesta2
O (desde 2022), úselo postnotes
en su lugar, ya que \label{...}
funciona de la manera típica/lógica y el paquete tiene una función de referencia cruzada adicional que podría gustarle. Citando del manual:
Las referencias cruzadas con notas posteriores funcionan de una manera bastante estándar: establezca una etiqueta, haga referencia a ella. Sin embargo, hay dos formas de asignar una etiqueta a una nota. Se puede configurar una etiqueta con la
label
opción de\postnote
o se puede configurar directamente con el estándar\label
como parte del contenido de la nota. Ambos son válidos, pero no son equivalentes, tienen significados diferentes y, en consecuencia, se comportan de manera diferente. [¶] La etiqueta configurada con lalabel
opción se establece en el lugar donde\postnote
está. La etiqueta establecida\label
en el contenido de la nota simplemente se almacena y solo se expande cuando este contenido se escribe en\printpostnotes
. En definitiva, lalabel
opción pertenece a la “marca”, mientras que el\label
conjunto en el contenido pertenece al “texto”.
\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}