为什么某些 biblatex 选项需要在序言中设置,而不能使用 \ExecuteBibliographyOptions 从样式文件中调用?

为什么某些 biblatex 选项需要在序言中设置,而不能使用 \ExecuteBibliographyOptions 从样式文件中调用?

.bbx我个人更喜欢使用在文件中设置 biblatex 的包选项\ExecuteBibliographyOptions,这样我就可以在我的序言中最低限度地调用 biblatex(最好只使用)。然而,我注意到,当使用但从\usepackage[style=myStyle, natbib=true,backend=biber]{biblatex}.bbx 文件解析时,某些选项不起作用\ExecuteBibliographyOptions必须供应前言使用\usepackage选项或\ExecuteBibliographyOptions。就我而言,我发现以下选项会导致问题,而其他选项则正常工作:

  1. 标签年份
  2. 唯一名称
  3. 唯一列表

当然,我只使用所有可能选项中的一小部分,因此很可能会有更多选项遇到同样的问题。


编辑-添加了最小示例


.bbx从外部文件调用选项

\documentclass{article}

\usepackage{filecontents}

\begin{filecontents}{mystyle.bbx}
% Build on the original author-year comp
\RequireBibliographyStyle{authoryear-comp}

\ExecuteBibliographyOptions{
    maxcitenames = 2, 
    mincitenames = 1, 
    firstinits = true,
    terseinits = false,
    labelyear=true,  
    uniquename=false, 
    uniquelist=false,
}
\end{filecontents}

\begin{filecontents}{mystyle.cbx}
\ProvidesFile{emi.cbx}[biblatex style for Environmental Microbiology]

\RequireCitationStyle{authoryear-comp}

\endinput
\end{filecontents}

\begin{filecontents}{\jobname.bib}
@article{ref1,
  author = {Doe, J. and Dane, D., and Dewy, R.},
  year = {2000},
  title = {This and that},
  journal = {Journal of deep understanding of things},
}

@article{ref2,
  author = {Doe, J. and Dewy, D., and Dane, R.},
  year = {2000},
  title = {The other},
  journal = {Journal of deep understanding of things},
}
\end{filecontents}

\usepackage[style=mystyle,natbib=true,backend=biber]{biblatex}

\addbibresource{\jobname.bib}

\begin{document}

Some text and a ref \citep{ref1}.
Then another ref with same first author and year \citep{ref2}

\printbibliography

\end{document}

产生不想要的输出: 在此处输入图片描述

但调用相同的选项会\usepackage产生所需的输出

\documentclass{article}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{ref1,
  author = {Doe, J. and Dane, D., and Dewy, R.},
  year = {2000},
  title = {This and that},
  journal = {Journal of deep understanding of things},
}

@article{ref2,
  author = {Doe, J. and Dewy, D., and Dane, R.},
  year = {2000},
  title = {The other},
  journal = {Journal of deep understanding of things},
}
\end{filecontents}

\usepackage[style=authoryear-comp,natbib=true, 
    maxcitenames = 2, 
    mincitenames = 1, 
    firstinits = true,
    labelyear=true,  
    uniquename=false, 
    uniquelist=false,
    terseinits = false,
    backend=biber]{biblatex}

\addbibresource{\jobname.bib}

\begin{document}

Some text and a ref \citep{ref1}.
Then another ref with same first author and year \citep{ref2}

\printbibliography

\end{document}

在此处输入图片描述

答案1

您的cbx文件已加载authoryear-comp.cbx。此文件包含以下行

\ExecuteBibliographyOptions{labelyear,uniquename,uniquelist,sortcites,autocite=inline}

由于cbx文件是在 之后加载的bbx,因此样式bbx文件中的选项设置将被覆盖。要解决此问题,请将选项设置移至cbx之后的文件中\RequireCitationStyle

相关内容