我正在使用 biblatex 打印参考书目。虽然 bib 条目中有adendum
和note
字段很方便,但我想知道是否有办法将它们从输出中删除。我尝试使用adendum=false
和note=false
,但它们不起作用。
\RequirePackage{filecontents}
\begin{filecontents*}{mybib.bib}
@Article{bibkey,
Title = {Some title},
Author = {John Joe},
Addendum = {some addendum},
note = {some notes},
Doi = {blah blah},
Month = {Feb},
Number = {2},
Pages = {950-955},
Volume = {62},
Journal = {J. LaTeX},
Keywords = {Some keyword},
}
\end{filecontents*}
\documentclass{article}
% Set the values for the bibliography
\usepackage[%
backend=bibtex8,% or bibtex8
style=numeric,%
sorting=ydnt,% sorted by year, descending
eprint = false,
url=false,
]{biblatex}
% Recommended for biblatex
\usepackage{csquotes}
\usepackage{xpatch}
% Set language
\usepackage[british]{babel}
\DeclareLanguageMapping{british}{british-apa}
\addbibresource{mybib.bib}
\begin{document}
some text \cite{bibkey}
\printbibliography
\end{document}
答案1
您可以使用\AtEveryBibitem
和\clearfield
\AtEveryBibitem{\clearfield{note}\clearfield{addendum}}
\AtEveryCitekey{\clearfield{note}\clearfield{addendum}}
第二行也从引用中删除了该字段。
如果您使用 Biber,您甚至可以在处理这些字段之前将其删除。
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldset=addendum, null]
\step[fieldset=note, null]
}
}
}
这样做的好处是,任何可能通常会使 TeX 崩溃的代码都不会被处理,从而变得无害。
\begin{filecontents}{\jobname.bib}
@Article{bibkey,
Title = {Some title},
Author = {John Joe},
Addendum = {some addendum},
note = {some notes},
Volume = {62},
Journal = {J. LaTeX},
}
\end{filecontents}
\documentclass{article}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[%
backend=biber,
style=numeric,
]{biblatex}
\addbibresource{\jobname.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldset=addendum, null]
\step[fieldset=note, null]
}
}
}
\begin{document}
\nocite{bibkey}
\printbibliography
\end{document}