我正在使用 biblatex 制作参考书目。我想要做的是找到所有具有给定作者的引文(即使它是具有多个作者的引文),并在引文前面添加星号。例如,我想确保所有以 Joe Bloggs 为作者之一的引文都采用以下格式:
[* 1] 约翰·史密斯、乔·布洛格斯。“为光荣的国家做出伟大发现”。《新事物杂志》。(1)1。第 1-10 页。
这可能吗?
我这样做的原因是为了在引用中用星号标记我作为作者的出版物。
\documentclass{article}
\usepackage[backend=biber,style=numeric]{biblatex}
%\usepackage{filecontents}
\begin{filecontents}{bam.bib}
@incollection{Bloggs:1,
title={Radio Resource Management for Device-to-Device Communications in Long Term Evolution Networks},
author={Joe Bloggs and John Smith},
booktitle={Resource Allocation and {MIMO} for {4G} and Beyond},
publisher={Springer Science+Business Media},
year=2014,
address={New York, USA},
editor={Francisco Rodrigo Porto Cavalcanti},
pages={105-156},
doi={10.1007/978-1-4614-8057-0_3},
isbn={978-1-4614-8056-3},
}
\end{filecontents}
\addbibresource{bam.bib}
\DeclareBibliographyCategory{asterisk}
\addtocategory{asterisk}{Bloggs:1}
\DeclareFieldFormat{labelnumber}{\ifcategory{asterisk}{*#1}{#1}}
\begin{document}
\cite{Bloggs:1}
\printbibliography
\end{document}
答案1
检查条目是否涉及特定作者的一种方法是通过正则匹配author
源映射中的字段。请参阅biblatex:在参考书目中分离特定作者的出版物。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[backend=biber, style=numeric]{biblatex}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\step[fieldsource=author,
match=\regexp{\b(Joe\s+Bloggs|Bloggs,\s+Joe)\b},
final]
\step[fieldset=keywords, fieldvalue={, }, appendstrict]
\step[fieldset=keywords, fieldvalue=filternames, append]
}
}
}
\DeclareFieldFormat{labelnumber}{%
\ifkeyword{filternames}
{*}
{}%
#1}
\begin{filecontents}{\jobname.bib}
@incollection{Bloggs:1,
title = {Radio Resource Management for Device-to-Device
Communications in Long Term Evolution Networks},
author = {Joe Bloggs and John Smith},
booktitle = {Resource Allocation and {MIMO} for {4G} and Beyond},
publisher = {Springer Science+Business Media},
year = 2014,
address = {New York, USA},
editor = {Francisco Rodrigo Porto Cavalcanti},
pages = {105-156},
doi = {10.1007/978-1-4614-8057-0_3},
isbn = {978-1-4614-8056-3},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{sigfridsson,Bloggs:1}
\printbibliography
\end{document}