(Biblatex) How to suppress page field in footcite if postnote is present?

(Biblatex) How to suppress page field in footcite if postnote is present?

对于我的论文,我使用的是biblatex风格oxnotes,这种风格与详细风格非常相似并使用脚注。

如果我使用\footcite带有指定后记的命令,对于带有页码的条目(例如书籍章节),脚注将打印两个都页码和附注。我想告诉您biblatex在有附注时隐藏脚注中的页码。

目前,\footcite像这样:

\footcite[1-5]{barkan2003}

...将产生脚注

Barkan,‘标题’,期刊名称(2003),1-20 至 1-5

我想在\footcite指定后记的命令中隐藏页面(即“1-20”),如下所示

Barkan,‘标题’,期刊名称(2003),1-5。

我尝试过以下命令,但它会抑制引文和参考书目中的页面字段。

\DeclareFieldFormat{pages}{%
    \iffieldundef{pages}{}{\iffieldundef{postnote}{}{\clearfield{pages}}}}

有没有办法告诉biblatex隐藏页面字段仅有的\footcite命令中,而不是在参考书目中?

如能提供任何解决方案方面的帮助,我们将不胜感激!

\documentclass{article}
\usepackage[style=oxnotes]{biblatex}
\RequireBibliographyStyle{oxref}

\begin{filecontents*}{document.bib}
@article{barkan2003,
  title = {Title},
  journaltitle = {Journal Title},
  date = {2003},
  pages = {1-20},
  author = {Barkan},
}
\end{filecontents*}
\addbibresource{document.bib}

\begin{document}
Text.\footcite[1-5]{barkan2003}
\end{document}

答案1

biblatex-oxrefoxnotes引用样式基于verbose.cbx并支持其所有选项。特别是,您可以使用选项citepages,该选项记录在verbose样式示例。(在早期版本中,biblatex-oxref某些方面有点citepages违反直觉,但在 1.1 版中得到了改进,请参阅https://github.com/alex-ball/biblatex-oxref/issues/8

  • -defaultoxnotescitepages=separate您提供

    Wolfgang A. Herrmann 等人,“碳环卡宾作为 C–C 偶联反应的有效催化配体”,Angew. Chem. Int. Ed.45/23 (2006),第 3859–62 页,第 3860–1 页。

  • 如果后记为数字,则自动省略该citepages=omit字段pages

    Wolfgang A. Herrmann 等人,“碳环卡宾作为 C–C 偶联反应的有效催化配体”,Angew. Chem. Int. Ed.45/23 (2006), 3860–1。

  • citepages=suppresspages即使后记不是数字,也会省略该字段。

  • citepages=permit(标准verbose样式的默认设置)将只显示两个字段

    Wolfgang A. Herrmann 等人,“碳环卡宾作为 C–C 偶联反应的有效催化配体”,Angew. Chem. Int. Ed. 45/23 (2006), 3859–62, 3860–1.

So you could try

\documentclass{article}

\usepackage[style=oxnotes, citepages=omit]{biblatex}

\addbibresource{biblatex-examples.bib}

\begin{document}
Text.\footcite[3860-3861]{herrmann}

\printbibliography
\end{document}

Wolfgang A. Herrmann et al., “A carbocyclic carbene as an efficient catalyst ligand for C–C coupling reactions”, *Angew. Chem. Int. Ed.* 45/23 (2006), 3860–1.


The \DeclareFieldFormat idea did not work because \iffieldundef{pages}{}{\iffieldundef{postnote}{}{\clearfield{pages}}} is not a command that prints anything. It only tells biblatex to delete pages in a certain situation. But \DeclareFieldFormat should be used to tell biblatex how to print stuff, compare with the default

\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{#1}}

or the simpler

\DeclareFieldFormat{title}{\mkbibemph{#1}}

A \DeclareFieldFormat should always involve a #1.

In essence this definition deletes the field in the case you want (and it would not delete the field in the bibliography, because \iffieldundef{postnote} would be true there), but it overwrites the definition that tells biblatex how to print the pages field in the first place, which means that it is always dropped in the output.

Deleting a field only in \DeclareFieldFormat could cause spurious punctuation because biblatex thinks it printed something when it didn't.

So I would not try and pursue that particular approach any further here.


Note that the

\RequireBibliographyStyle{oxref}

was not required. In general you shouldn't have to use \RequireBibliographyStyle or \RequireCitationStyle in a document. The style is loaded via biblatex's style option (or separately via bibstyle and citestyle).

相关内容