Verweisen Sie auf eine Endnote mit dem Paket „enotez“, das auf die falsche Note verweist

Verweisen Sie auf eine Endnote mit dem Paket „enotez“, das auf die falsche Note verweist

Ich habe zuvor den \footrefBefehl aus dem footmiscPaket verwendet, um auf eine Endnote zu verweisen. Dies hat in Kombination mit dem endnotesPaket problemlos funktioniert:

\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}

Bildbeschreibung hier eingeben

Aber ich bin jetzt auf das Paket umgestiegen enotez, und das funktioniert nicht mehr richtig. Im folgenden MWE bezieht sich der Verweis auf die erste Endnote stattdessen auf die zweite Endnote.

\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}

Bildbeschreibung hier eingeben

Wie kann ich enotezauf die richtige Endnote verweisen?

Antwort1

Der enotezBefehl \labelsollte außerhalb des Endnotentextes stehen; siehe das letzte Beispiel in Abschnitt 3.1.

Das ist nicht nötig , da Sie einen Befehl mit folgenden Funktionen footmiscdefinieren können :\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}

Bildbeschreibung hier eingeben

Wenn Sie mehrere Instanzen von „multiple“ haben \footref, können Sie eine verkürzte Syntax in Betracht ziehen:

\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}

Antwort2

Oder (seit 2022) verwenden Sie postnotesstattdessen, da \label{...}es auf die typische/logische Weise funktioniert und das Paket über eine weitere Querverweisfunktion verfügt, die Ihnen gefallen könnte. Zitat aus dem Handbuch:

Querverweise mit Postnotes funktionieren ziemlich standardmäßig: ein Label setzen, darauf verweisen. Es gibt jedoch zwei Möglichkeiten, einer Notiz ein Label zu setzen. Man kann entweder ein Label mit der labelOption setzen \postnoteoder es direkt mit dem Standard \labelals Teil des Inhalts der Notiz setzen. Beide sind gültig, aber sie sind nicht gleichwertig, sie haben unterschiedliche Bedeutungen und verhalten sich dementsprechend unterschiedlich. [¶] Das mit der labelOption gesetzte Label wird an der Stelle gesetzt, an der \postnotesteht. Das mit im Inhalt der Notiz gesetzte Label \labelwird nur gespeichert und erst erweitert, wenn dieser 13Inhalt gesetzt wird, bei \printpostnotes. Kurz gesagt, die labelOption gehört zur „Markierung“, während das \labelim Inhalt gesetzte zum „Text“ gehört.

\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}

verwandte Informationen