我使用 Zotero 来管理我的参考文献。然后,我从 Zotero 导出 .bib 文件 (Biblatex)。
问题是,如果没有作者,括号里会有一个空的。此外,如果是网页引用,作者姓名后面也会有一个空的括号。
@online{shotts_learning_nodate,
title = {Learning the shell - Lesson 1: What is the shell?},
url = {https://linuxcommand.org/lc3_lts0010.php},
author = {Shotts, William},
urldate = {2020-12-14},}
上面的 .bib 代码导致作者姓名后出现一个空括号。
@online{noauthor_what_nodate,
title = {What is Linux?},
url = {https://www.linux.com/what-is-linux/},
titleaddon = {Linux.com},
urldate = {2021-01-20},
langid = {american},}
如果没有作者,上面的 .bib 代码将导致出现空括号。
这是我的 LateX 代码
\documentclass[12pt,a4paper]{report}
\begin{document}
\usepackage[style=ieee]{biblatex}
\addbibresource{Exported_Items.bib}
\printbibliography[title={REFERENCES}]
\include{Chapter1}
\include{Chapter2}
\end{document}
结果是:
[1] (). “What is linux?” Linux.com, [Online].
Available:https://www.linux.com/what-is-linux/(visited on 01/20/2021).
[2] W. Shotts. (). “Learning the shell - lesson 1: What is the shell?”
[Online]. Available:https://linuxcommand.org/lc3_lts0010.php(visited
on 12/14/2020).
谢谢。
答案1
第一个解决方案。使用year
字段。例如:
@online{shotts_learning_nodate,
title = {Learning the shell - Lesson 1: What is the shell?},
url = {https://linuxcommand.org/lc3_lts0010.php},
author = {Shotts, William},
year = {2020},
urldate = {2020-12-14},}
第二种解决方案。修改@online 驱动程序,以便如果year
为空则不打印任何内容:
\begin{filecontents*}[overwrite]{Exported_Items.bib}
@online{shotts_learning_nodate,
title = {Learning the shell - Lesson 1: What is the shell?},
url = {https://linuxcommand.org/lc3_lts0010.php},
author = {Shotts, William},
urldate = {2020-12-14},}
@online{noauthor_what_nodate,
title = {What is Linux?},
url = {https://www.linux.com/what-is-linux/},
titleaddon = {Linux.com},
langid = {american},}
\end{filecontents*}
\documentclass[12pt,a4paper]{report}
\usepackage[style=ieee]{biblatex}
\addbibresource{Exported_Items.bib}
\usepackage{xpatch}
\xpatchbibdriver{online}
{\printtext[parens]{\usebibmacro{date}}}
{\iffieldundef{year}{}{\printtext[parens]{\usebibmacro{date}}}}
{}{}
\begin{document}
\cite{shotts_learning_nodate}
\cite{noauthor_what_nodate}
\printbibliography[title={REFERENCES}]
\end{document}
解释。驱动程序@online
(在中定义ieee.bbx
)使用此代码来打印日期字段:
\DeclareBibliographyDriver{online}{%
...
\printtext[parens]{\usebibmacro{date}}%
...
}
因此,如果没有声明日期,上述宏将打印两个没有内容的括号(\printtext[parens]{...}
)。
答案2
对于我来说,这个问题已经通过导出参考资料解决了佐特罗作为比比泰克。此外,我保留了比布拉特克斯作为 Latex 中的参考文献管理器。