\defbibentryset 和重复引用的问题

\defbibentryset 和重复引用的问题

我正在尝试使用 \defbibentryset 对我的参考书目进行排序,以生成具有以下样式的引用:

[3] a)第一个来源 b)第二个来源 c)第三个来源。

问题是,当我在其他页面使用 \defbibentryset 再次引用预定义集合中的某个来源时,它会在本页面的脚注中重复出现。此行为仅在这种情况下发生,如果来源不是集合的一部分,则在重复时会将其省略,这是理所当然的。

这很糟糕,因为我只希望在第一次调用时引用来源。

这里我发布了一个包含我正在使用的代码的最小工作示例。由于我对 Latex 还不太熟悉,所以代码是从其他地方获取的。非常感谢。

\documentclass{article}
\usepackage[subentry,style=chem-acs]{biblatex}


\bibliography{biblatex-examples}
\makeatletter
\renewcommand*{\thefootnote}{(\arabic{footnote})}
\ExecuteBibliographyOptions{citetracker,sorting=none}

\DeclareCiteCommand{\superfullcite}[\cbx@superscript]%
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \usebibmacro{superfullcite}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}}

\newbibmacro*{superfullcite}{%
  \ifciteseen
    {}
    {\xappto\cbx@citehook{%
       \noexpand\footnotetext[\thefield{labelnumber}]{%
         \fullcite{\thefield{entrykey}}.}}}}

\newrobustcmd{\cbx@superscript}[1]{%
  \mkbibsuperscript{#1}%
  \cbx@citehook
  \global\let\cbx@citehook=\empty}
\let\cbx@citehook=\empty
\usepackage[hang]{footmisc}
\setlength{\footnotemargin}{10mm}

\makeatother
\begin{document}

\defbibentryset{set1}{cotton,hammond}

Lets cite a set that includes Cotton and Hammond \superfullcite{set1}. And a cite Goossens that it is not part of a set \superfullcite{companion}.

\newpage

Now lets cite only Cotton \superfullcite{cotton}. As you can see this citation should be omited in the footnote as it is already present is page one (unwanted behaviour). And now lets cite Goossens. This cite is ommited in footnotes because it is repeated and it is not part of a set (right behaviour).\superfullcite{companion} 


\end{document}

答案1

由于如果引用了整个集合,biblatex则不会将某个@set条目计为引用,因此我们需要定义一个额外的测试来满足这种情况。\ifciteseen

\newcommand*{\ifsetentryseen}{%
  \iffieldundef{entrysetcount}
    {\@secondoftwo}
    {\ifentryseen{\thefield{entryset}}}}

测试当前引用是否是之前引用过的集合条目。然后使用测试\ifciteseen

\newbibmacro*{superfullcite}{%
  \ifboolexpr{test {\ifciteseen} or test {\ifsetentryseen}}
    {}
    {\xappto\cbx@citehook{%
       \noexpand\footnotetext[\thefield{labelnumber}]{%
         \fullcite{\thefield{entrykey}}.}}}}

总共

\documentclass{article}
\usepackage[subentry,style=chem-acs]{biblatex}

\makeatletter
\renewcommand*{\thefootnote}{(\arabic{footnote})}
\ExecuteBibliographyOptions{citetracker,sorting=none}

\DeclareCiteCommand{\superfullcite}[\cbx@superscript]%
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \usebibmacro{superfullcite}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}}

\newcommand*{\ifsetentryseen}{%
  \iffieldundef{entrysetcount}
    {\@secondoftwo}
    {\ifentryseen{\thefield{entryset}}}}

\newbibmacro*{superfullcite}{%
  \ifboolexpr{test {\ifciteseen} or test {\ifsetentryseen}}
    {}
    {\xappto\cbx@citehook{%
       \noexpand\footnotetext[\thefield{labelnumber}]{%
         \fullcite{\thefield{entrykey}}.}}}}

\newrobustcmd{\cbx@superscript}[1]{%
  \mkbibsuperscript{#1}%
  \cbx@citehook
  \global\let\cbx@citehook=\empty}
\let\cbx@citehook=\empty

\makeatother


\addbibresource{biblatex-examples.bib}

\begin{document}

\defbibentryset{set1}{cotton,hammond}

Lets cite a set that includes Cotton and Hammond \superfullcite{set1}. And a cite Goossens that it is not part of a set \superfullcite{companion}.

\newpage

Now lets cite only Cotton \superfullcite{cotton}. As you can see this citation should be omited in the footnote as it is already present is page one (unwanted behaviour). And now lets cite Goossens. This cite is ommited in footnotes because it is repeated and it is not part of a set (right behaviour).\superfullcite{companion} 
\end{document}

第 2 页没有脚注。

相关内容