我使用这种ieee-alphabteic
风格biblatex
,因为我有很多来自 arXiv 的草稿,所以它们被视为已发表的文章。对于一些人来说,该领域
pages={...},
存在,但有些则不存在。如何才能biblatex
跳过 arXiv 预印本的页面字段?
[因为我从 Mendeley 获得了 .bib,所以我可以选择 arXiv 中的所有论文并删除页面字段,但是假设我希望在侧面使用一种方法biblatex
]
我的 arXiv 中的一个典型条目.bib
是
@article{Ashtekar1997,
archivePrefix = {arXiv},
arxivId = {arXiv:gr-qc/9706069v1},
author = {Ashtekar, A and Schilling, T},
eprint = {9706069v1},
pages = {1--41},
primaryClass = {arXiv:gr-qc},
title = {{Geometrical Formulation of Quantum Mechanics}},
year = {1997}
}
答案1
biblatex
这可以通过测试字段的文本来完成archivePrefix
。使用与moewe 有,则可进行以下操作:
\documentclass[ngerman, a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=ieee-alphabetic, backend=bibtex]{biblatex}
\addbibresource{\jobname.bib}
\renewbibmacro*{pages}{%
\iffieldequalstr{archivePrefix}{arXiv}
{}
{%
\iffieldequalstr{eprinttype}{arxiv}
{}
{%
\setunit{\bibpagespunct}%
\printfield{pages}%
}%
}%
}
\begin{filecontents}{\jobname.bib}
@article{KingZengHistoryGuide,
author = {Gary King and Langche Zeng},
title = {When Can History Be Our Guide?},
subtitle = {The Pitfalls of Counterfactual Inference},
journaltitle = {International Studies Quarterly},
volume = {51},
date = {2007-03},
pages = {183-210},
url = {http://gking.harvard.edu/files/abs/counterf-abs.shtml},
urldate = {2012-06-05},
gender = {pm},
}
@article{Ashtekar1997,
archivePrefix = {arXiv},
arxivId = {arXiv:gr-qc/9706069v1},
author = {Ashtekar, A and Schilling, T},
eprint = {9706069v1},
pages = {1--41},
primaryClass = {arXiv:gr-qc},
title = {{Geometrical Formulation of Quantum Mechanics}},
year = {1997}
}
@article{DBLP:journals/corr/abs-1008-2849,
author = {Jan Wassenberg and Peter Sanders},
title = {Faster Radix Sort via Virtual Memory and Write-Combining},
eprinttype = {arxiv},
eprintclass = {cs.DS},
eprint = {1008.2849},
date = {2010-09-06},
pages = {1-8},
}
\end{filecontents}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
请注意,这里的测试区分大小写:不区分大小写的测试也是可行的,但需要做更多的工作,因此我假设输入数据集是“格式良好的”。
答案2
如果您使用biber
,\DeclareSourcemap
则完全符合您的要求。只需将其添加到您的序言中即可。
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=eprinttype,match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$},final]
\step[fieldset=pages,null]
}
\map{
\step[fieldsource=archivePrefix,match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$},final]
\step[fieldset=pages,null]
}
}
}
此代码查看字段archivePrefix
和eprinttype
字段(前者实际上是后者的链接)并检查是否仅包含arxiv
(无论如何变化),如果是,则pages
重置该字段。
平均能量损失
\documentclass[ngerman, a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=ieee-alphabetic, backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=eprinttype,match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$},final]
\step[fieldset=pages,null]
}
\map{
\step[fieldsource=archivePrefix,match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$},final]
\step[fieldset=pages,null]
}
}
}
\begin{filecontents}{\jobname.bib}
@article{KingZengHistoryGuide,
author = {Gary King and Langche Zeng},
title = {When Can History Be Our Guide?},
subtitle = {The Pitfalls of Counterfactual Inference},
journaltitle = {International Studies Quarterly},
volume = {51},
date = {2007-03},
pages = {183-210},
url = {http://gking.harvard.edu/files/abs/counterf-abs.shtml},
urldate = {2012-06-05},
gender = {pm},
}
@article{Ashtekar1997,
archivePrefix = {arXiv},
arxivId = {arXiv:gr-qc/9706069v1},
author = {Ashtekar, A and Schilling, T},
eprint = {9706069v1},
pages = {1--41},
primaryClass = {arXiv:gr-qc},
title = {{Geometrical Formulation of Quantum Mechanics}},
year = {1997}
}
@article{DBLP:journals/corr/abs-1008-2849,
author = {Jan Wassenberg and Peter Sanders},
title = {Faster Radix Sort via Virtual Memory and Write-Combining},
eprinttype = {arxiv},
eprintclass = {cs.DS},
eprint = {1008.2849},
date = {2010-09-06},
pages = {1-8},
}
\end{filecontents}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
产量
编辑
您的arXiv
链接似乎格式不正确biblatex
,要更改此问题,您可以将以下内容添加到序言中
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=eprinttype, match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$}, final]
\step[fieldset=pages, null]
}
\map{
\step[fieldsource=archivePrefix, match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$}, final]
\step[fieldset=pages, null]
}
\map[overwrite]{%<---- this maps your example article to the proper arxiv site
\step[fieldsource=archivePrefix, match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$}, final]
\step[fieldsource=arxivId, fieldtarget=eprint]
\step[fieldsource=eprint, match=\regexp{[a|A][r|R][x|X][i|I][v|V]:}, replace=\regexp{$1}]
\step[fieldset=primaryClass, null]
}
}
}
数学家协会
\documentclass[ngerman, a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=ieee-alphabetic, backend=biber]{biblatex}
\usepackage{hyperref}
\addbibresource{\jobname.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=eprinttype, match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$}, final]
\step[fieldset=pages, null]
}
\map{
\step[fieldsource=archivePrefix, match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$}, final]
\step[fieldset=pages, null]
}
\map[overwrite]{
\step[fieldsource=archivePrefix, match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$}, final]
\step[fieldsource=arxivId, fieldtarget=eprint]
\step[fieldsource=eprint, match=\regexp{[a|A][r|R][x|X][i|I][v|V]:}, replace=\regexp{$1}]
\step[fieldset=primaryClass, null]
}
}
}
\begin{filecontents}{\jobname.bib}
@article{KingZengHistoryGuide,
author = {Gary King and Langche Zeng},
title = {When Can History Be Our Guide?},
subtitle = {The Pitfalls of Counterfactual Inference},
journaltitle = {International Studies Quarterly},
volume = {51},
date = {2007-03},
pages = {183-210},
url = {http://gking.harvard.edu/files/abs/counterf-abs.shtml},
urldate = {2012-06-05},
gender = {pm},
}
@article{Ashtekar1997,
archivePrefix = {arXiv},
arxivId = {arXiv:gr-qc/9706069v1},
author = {Ashtekar, A and Schilling, T},
eprint = {9706069v1},
pages = {1--41},
primaryClass = {arXiv:gr-qc},
title = {{Geometrical Formulation of Quantum Mechanics}},
year = {1997}
}
@article{DBLP:journals/corr/abs-1008-2849,
author = {Jan Wassenberg and Peter Sanders},
title = {Faster Radix Sort via Virtual Memory and Write-Combining},
eprinttype = {arxiv},
eprintclass = {cs.DS},
eprint = {1008.2849},
date = {2010-09-06},
pages = {1-8},
}
\end{filecontents}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
请 注意链接中的差异。