我想要投稿的杂志要求对具有“特殊”和“突出”意义的参考文献分别标记一个或两个星号,如下所示:
This is a normal reference [1].
This is a special reference [2*].
This is an outstanding reference [3**].
我成功地创建了“特殊”的单星号类别,如下所示这个答案。但是,如果我尝试创建两个类别,则只有其中一个类别的格式符合我的要求。有没有更好的方法来创建具有自定义格式的参考类别?
我的参考MWE:
@Article{Bolton1982,
author = {Bolton, David C and McKinley, Michael P and Prusiner, Stanley B},
journal = {Science},
title = {Identification of a protein that purifies with the scrapie prion},
}
@Article{Basler1986,
author = {Basler, K and Oesch, B and Scott, M and Westaway, D and Wälchli, M and Groth, DF and McKinley, MP and Prusiner, SB and Weissmann, C},
journal = {Cell},
title = {Scrapie and cellular PrP isoforms are encoded by the same chromosomal gene},
}
@Article{Scheckel2018,
author = {Scheckel, C. and Aguzzi, A.},
journal = {Nat Rev Genet},
title = {Prions, prionoids and protein misfolding disorders},
}
我的文档 MWE:
\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[sorting=none]{biblatex}
\let\origcite\cite%
\def\cite#1{\unskip~\origcite{#1}}
\usepackage{csquotes}
\addbibresource{my_references.bib}
%declare categories
\DeclareBibliographyCategory{special}
\DeclareFieldFormat{labelnumber}{\ifcategory{special}{#1*}{#1}}
\DeclareBibliographyCategory{outstanding}
\DeclareFieldFormat{labelnumber}{\ifcategory{outstanding}{#1**}{#1}}
\begin{document}
%reference categories
\addtocategory{special}{Bolton1982}
\addtocategory{outstanding}{Basler1986}
\parencite{Bolton1982}
\parencite{Basler1986}
\parencite{Scheckel2018}
\printbibliography
\end{document}
答案1
后续\DeclareFieldFormat
调用将互相覆盖,因此只有最后一次调用有效。
你必须把这两个定义结合起来
\DeclareFieldFormat{labelnumber}{\ifcategory{special}{#1*}{#1}}
\DeclareFieldFormat{labelnumber}{\ifcategory{outstanding}{#1**}{#1}}
合为一体
\DeclareFieldFormat{labelnumber}{%
\ifcategory{outstanding}
{#1**}
{\ifcategory{special}
{#1*}
{#1}}}
然后
\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{csquotes}
\usepackage[sorting=none]{biblatex}
\DeclareBibliographyCategory{special}
\DeclareBibliographyCategory{outstanding}
\DeclareFieldFormat{labelnumber}{%
\ifcategory{outstanding}
{#1**}
{\ifcategory{special}
{#1*}
{#1}}}
\addtocategory{special}{geer}
\addtocategory{outstanding}{sigfridsson}
\addbibresource{biblatex-examples.bib}
\begin{document}
\autocite{sigfridsson}
\autocite{worman}
\autocite{geer}
\printbibliography
\end{document}
产量