我已经自动生成了 bibtex 条目,例如:
@article{Gasser:1984gg,
author = "Gasser, J. and Leutwyler, H.",
title = "{Chiral Perturbation Theory: Expansions in the Mass of
the Strange Quark}",
journal = "Nucl. Phys.",
volume = "B250",
year = "1985",
pages = "465-516",
doi = "10.1016/0550-3213(85)90492-4",
reportNumber = "CERN-TH-3798",
SLACcitation = "%%CITATION = NUPHA,B250,465;%%"
}
@article{Leutwyler:1992yt,
author = "Leutwyler, H. and Smilga, Andrei V.",
title = "{Spectrum of Dirac operator and role of winding number in
QCD}",
journal = "Phys. Rev.",
volume = "D46",
year = "1992",
pages = "5607-5632",
doi = "10.1103/PhysRevD.46.5607",
reportNumber = "BUTP-92-10",
SLACcitation = "%%CITATION = PHRVA,D46,5607;%%"
}
@article{Chou:1983qy,
author = "Chou, Kuang-chao and Guo, Han-ying and Wu, Ke and Song,
Xing-chang",
title = "{On the Gauge Invariance and Anomaly Free Condition of
{Wess-Zumino}-witten Effective Action}",
journal = "Phys. Lett.",
volume = "134B",
year = "1984",
pages = "67-69",
doi = "10.1016/0370-2693(84)90986-9",
reportNumber = "AS-ITP-83-027",
SLACcitation = "%%CITATION = PHLTA,134B,67;%%"
}
不幸的是,日记帐字段的最后一个字母有时会存储为卷字段的第一个或最后一个字母。有没有办法biblatex
自动将字母从卷字段的开头或结尾移动到日记帐字段的末尾?
因此,我想将左侧的条目视为以右侧的形式给出:
journal = "Nucl. Phys.", --> journal = "Nucl. Phys. B",
volume = "B250", --> volume = "250",
journal = "Phys. Rev.", --> journal = "Phys. Rev. D",
volume = "D46", --> volume = "46",
journal = "Phys. Lett.", --> journal = "Phys. Lett. B",
volume = "134B", --> volume = "134",
答案1
由于您正在使用,biblatex
您可以使用 Biber 源映射来操作来自文件的输入数据.bib
。
需要额外的映射步骤\step[fieldsource=journal, fieldtarget=journaltitle]
是因为该journal
字段是内部调用的journaltitle
,而通常处理该问题的自动映射在错误的时间执行。
.bib
仅对文件进行一次更正,然后使用文件的干净版本,而不是让 Biber 每次都执行映射,这可能会很有用。
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear, backend=biber]{biblatex}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\step[fieldsource=volume, match=\regexp{\A(\p{L}+)?\d+(\p{L}+)?\Z}, final]
\step[fieldsource=volume, match=\regexp{\A(\p{L}+)?(\d+)(\p{L}+)?\Z}, replace={$2}]
\step[fieldsource=journal, fieldtarget=journaltitle]
\step[fieldset=journaltitle, fieldvalue={\space$1$2}, append=true]
}
}
}
\begin{filecontents}{\jobname.bib}
@article{gasser,
author = {Gasser, J. and Leutwyler, H.},
title = {Chiral Perturbation Theory: Expansions in the Mass of
the Strange Quark},
journal = {Nucl. Phys.},
volume = {B250},
year = {1985},
pages = {465-516},
doi = {10.1016/0550-3213(85)90492-4},
reportNumber = {CERN-TH-3798},
}
@article{leutwyler,
author = {Leutwyler, H. and Smilga, Andrei V.},
title = {Spectrum of {Dirac} Operator and Role of Winding Number in
{QCD}},
journal = {Phys. Rev.},
volume = {D46},
year = {1992},
pages = {5607-5632},
doi = {10.1103/PhysRevD.46.5607},
reportNumber = {BUTP-92-10},
}
@article{chou,
author = {Chou, Kuang-chao and Guo, Han-ying and Wu, Ke and Song,
Xing-chang},
title = {On the Gauge Invariance and Anomaly Free Condition of
{Wess--Zumino--Witten} Effective Action},
journal = {Phys. Lett.},
volume = {134B},
year = {1984},
pages = {67-69},
doi = {10.1016/0370-2693(84)90986-9},
reportNumber = {AS-ITP-83-027},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{gasser,leutwyler,chou,sigfridsson}
\printbibliography
\end{document}