Biblatex 仅对选定的关键字使用前缀

Biblatex 仅对选定的关键字使用前缀

我正在尝试生成一个出版物编号列表,其中一些出版物应使用“S”前缀突出显示,例如 [S1]。其他出版物应正常显示。到目前为止,我无法使用 BibLateX 实现此目的,因为我只能获取参考书目列表中突出显示的论文。

平均能量损失

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=numeric,backend=biber]{biblatex} 
\begin{filecontents*}{\jobname.bib}
@ARTICLE{art2,
author={John Doe and Jane Roe},
journal={Journal of Teamwork},
title={Some title},
year={2007},
month={Dec},
volume={11},
number={8}
}
@ARTICLE{art3,
author={John Doe},
journal={Some Journal},
title={A great paper},
year={2009},
month={Jan},
volume={45},
number={1},
keywords={first}
}
@ARTICLE{art3,
author={Jane Roe},
journal={Journal of Articles},
title={An Article by Jane},
year={2010},
month={Feb},
volume={46},
number={2}
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\begin{document}
\assignrefcontextkeyws[labelprefix=S]{keyword=first}
\assignrefcontextkeyws[labelprefix={}]{notkeyword=first}

\nocite{*}
\printbibliography[keyword=first,notkeyword=first,heading=none]
\end{document}

我希望此代码能够产生如下结果:

 [1] John Doe and Jane Roe, "Some title", Journal of teamwork 11 (2007).
[S2] John Doe, "A great paper", Some Journal 45 (2009).
 [3] Jane Roe, "An article by Jane", Journal of Articles 46 (2010).

答案1

如果您只想用附加的“S”标记一些带有特定关键字的特殊条目,但不想将它们分成不同的参考书目列表,那么最简单的方法可能是labelnumber根据需要将标记注入格式。

\DeclareFieldFormat{labelnumber}{%
  \ifkeyword{first}{S}{}%
  #1}

你不需要任何\assignrefcontextkeyws。(正确的语法应该是\assignrefcontextkeyws[labelprefix=S]{first},并且没有notkeyword版本。)

平均能量损失

\documentclass{article}
\usepackage[style=numeric,backend=biber]{biblatex}

\DeclareFieldFormat{labelnumber}{%
  \ifkeyword{first}{S}{}%
  #1}

\begin{filecontents*}{\jobname.bib}
@ARTICLE{art2,
  author={John Doe and Jane Roe},
  journal={Journal of Teamwork},
  title={Some title},
  year={2007},
  month={Dec},
  volume={11},
  number={8},
}
@ARTICLE{art1,
  author={John Doe},
  journal={Some Journal},
  title={A great paper},
  year={2009},
  month={Jan},
  volume={45},
  number={1},
  keywords={first},
}
@ARTICLE{art3,
  author={Jane Roe},
  journal={Journal of Articles},
  title={An Article by Jane},
  year={2010},
  month={Feb},
  volume={46},
  number={2},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
\cite{art1} \cite{art2} \cite{art3}
\printbibliography
\end{document}

给出 S1 2 3

相关内容