我想得到一份没有作者姓名的参考书目(如果您想知道的话,这是简历中参考书目的一部分)。我尝试过使用该clearlist
命令,但我想我用错了。
xelatex
以下是我用- biber
- xelatex
-编译的 MWE xelatex
:
\documentclass{article}
\usepackage[style=authoryear,maxbibnames=99]{biblatex}
\usepackage{hyperref}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% to create a file when first processed
% \begin{filecontents}[<options>]{<filename>}
% possible options: overwrite, nosearch, noheader
\begin{filecontents}{bib_2ndtry.bib}
@misc{A2020,
author = {Author, A. and Author, B. and Author C.},
year = {2020},
title = {Alpha},
}
@misc{B2021,
author = {Buthor, A.},
year = {2021},
title = {Bravo},
}
@misc{C2022,
author = {Cuthor, A. and Cuthor, B. and Cuthor, C.},
year = {2022},
title = {Charlie},
}
\end{filecontents}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% modifying bibliography items (well, trying to)
\AtEveryBibitem{
\clearlist{author}
}
\addbibresource{bib_2ndtry.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
在最终的 pdf 中,作者仍然包括在内,见附图:
我错过了什么?
答案1
要使用源图执行此操作,请将其放在序言中:
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldset=author, null]
}
}
}
这将在biblatex
看到数据之前从每个引用条目中删除所有作者字段。您可以以任意方式对此进行条件化 - 只在某些条目类型中删除,只在某些其他字段存在时删除等等,只需添加到此示例中即可。例如,要仅删除misc
条目类型中的作者字段,请执行以下操作:
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\pertype{misc}
\step[fieldset=author, null]
}
}
}
答案2
阅读后官方 biblatex 文档,我找到了我的问题的答案:我需要用\clearlist{author}
替换\clearname{author}
。