我正在使用 biblatex 和 biber,其定义如下:
\usepackage[
backend=biber,
sorting=none,
backref=true,
% firstinits=true,
style=numeric-comp
]{biblatex}
\DefineBibliographyStrings{english}{
backrefpage = {cited on p.},
backrefpages = {cited on pp.}
}
我有一个定义如下的书目项目:
@book{yellow-hl-lhc,
author = "Apollinari, G and Béjar Alonso, I and Brüning, O and Lamont, M and
Rossi, L",
title = "{High-Luminosity Large Hadron Collider (HL-LHC):
Preliminary Design Report}",
publisher = "CERN",
address = "Geneva",
series = "CERN Yellow Reports: Monographs",
year = "2015",
url = "https://cds.cern.ch/record/2116337",
doi = "10.5170/CERN-2015-005"
}
结果如下:
是否可以定义一个名为的新字段,cds
其工作方式如下doi
,以便在.bib
文件中我可以写入cds = "2116337"
并将“CDS:2116337”添加到参考书目中的项目中,并将编号链接到 URL?
答案1
为了方便后人,以下是我根据答案所做的事情的清单这里,这是评论中提出的。
里面biblatex-dm.cfg
,可以放在与主.tex
文件相同的目录中,
\DeclareDatamodelFields[type=field,datatype=verbatim]{cds}
\DeclareDatamodelEntryfields{cds}
在主要.tex
之后\usepackage{biblatex}
,之前\begin{document}
,
\DeclareFieldFormat{cds}{%
\textsc{cds}\addcolon\space
\ifhyperref
{\href{https://cds.cern.ch/record/#1}{\nolinkurl{#1}}}
{\nolinkurl{#1}}}
\renewbibmacro*{doi+eprint+url}{%
\iftoggle{bbx:doi}
{\printfield{doi}}
{}%
\newunit\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
\newunit\newblock
\printfield{cds}%
\newunit\newblock
\iftoggle{bbx:url}
{\usebibmacro{url+urldate}}
{}}