如何在 biblatex 中引用第一次出现的引文

如何在 biblatex 中引用第一次出现的引文

如何才能获得某个条目首次被引用的脚注编号\ifciteseen

梅威瑟:

\documentclass{article}

\usepackage[
    backend=biber,
    citetracker=true,
]{biblatex}

\addbibresource{biblatex-examples.bib}

\renewbibmacro*{cite}{%
    \printnames{labelname}
    \setunit{\nametitledelim}
    \ifciteseen{%
        \printfield{shorttitle}%
        \printtext{\addspace(seen in footnote~\ldots)}
    }{%
        \printfield{title}
    }
}

\begin{document}

\footcite{angenendt}
\footcite{angenendt}

\end{document}

在此处输入图片描述

答案1

我们可以从verbose-note.cbx

“在脚注中看到”位可以通过seenotebibstring进行国际化

\DefineBibliographyStrings{english}{seenote = {seen in footnote}}

完整代码

\documentclass{article}

\usepackage[
    backend=biber,
    citetracker=true,
]{biblatex}
\usepackage{hyperref}
\addbibresource{biblatex-examples.bib}

\makeatletter
\newtoggle{cbx:pageref}

\DeclareBibliographyOption[boolean]{pageref}[true]{%
  \settoggle{cbx:pageref}{#1}%
  \iftoggle{cbx:pageref}
    {\ExecuteBibliographyOptions{pagetracker}}
    {}}

\DeclareFieldFormat{bibhyperlink}{%
  \bibhyperlink{%
    \thefield{entrykey}:\csuse{cbx@\iffootnote{f}{t}@\thefield{entrykey}}}{#1}}
\DeclareFieldFormat{bibhypertarget}{%
  \bibhypertarget{\thefield{entrykey}:\the\value{instcount}}{#1}}

\newbibmacro*{footcite:save}{%
  \csxdef{cbx@f@\thefield{entrykey}}{\the\value{instcount}}%
  \label{cbx@\the\value{instcount}}}
\newbibmacro*{cite:seenote}{%
  \printtext{%
    {\bibstring{seenote}\addnbspace
     \ref{cbx@\csuse{cbx@f@\thefield{entrykey}}}%
     \iftoggle{cbx:pageref}
       {\ifsamepage{\the\value{instcount}}{\csuse{cbx@f@\thefield{entrykey}}}
          {}
         {\addcomma\space\bibstring{page}\addnbspace 
           \pageref{cbx@\csuse{cbx@f@\thefield{entrykey}}}}}
       {}}}}

\renewbibmacro*{cite}{%
  \printnames{labelname}%
  \setunit{\nametitledelim}%
  \ifciteseen%
    {\printfield[citetitle]{labeltitle}%
     \setunit{\addcomma\space}%
     \usebibmacro{cite:seenote}}
    {\printfield{title}%
     \iffootnote{\usebibmacro{footcite:save}}{}}}
\makeatletter

\DefineBibliographyStrings{english}{seenote = {seen in footnote}}

\begin{document}
Lorem\footcite{angenendt}
ipsum\footcite{angenendt,sigfridsson}
dolor\footcite{sigfridsson}
sit\footcite{angenendt}.
\end{document}

相关内容