我知道这个论坛上有很多与我的问题非常相似的问题,但我仍然不明白如何修复我的错误。由于我是 Latex 新手,我想为我的文档创建参考书目,所以我按照 Overleaf 的这篇关于使用比布拉特克斯。我的问题可能是创建 .bib 文件时出现的问题:我是否可以打开一个新的空文件 Latex,写入如下代码
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004",
keywords = "physics"
}
@book{dirac,
title = {The Principles of Quantum Mechanics},
author = {Paul Adrien Maurice Dirac},
isbn = {9780198520115},
series = {International series of monographs on physics},
year = {1981},
publisher = {Clarendon Press},
keywords = {physics}
}
@online{knuthwebsite,
author = "Donald Knuth",
title = "Knuth: Computers and Typesetting",
url = "http://www-cs-faculty.stanford.edu/~uno/abcde.html",
addendum = "(accessed: 01.09.2016)",
keywords = "latex,knuth"
}
@inbook{knuth-fa,
author = "Donald E. Knuth",
title = "Fundamental Algorithms",
publisher = "Addison-Wesley",
year = "1973",
chapter = "1.2",
keywords = "knuth,programming"
}
...
并将文件另存为 .bib 文档?之后,我尝试导入我的 .bib 文件(我将其称为“sample”),如下所示:
\documentclass[12pt,a4paper]{article}
\usepackage[english]{babel}
\usepackage{biblatex}
\addbibresource{sample.bib}
\begin{document}
The Einstein's journal paper \cite{einstein} and the Dirac's
book \cite{dirac} are physics related items.
\printbibliography
\end{document}
问题是 .bib 外部文件似乎无法正确导入。事实上,运行代码时 Latex 不会生成任何参考书目,因为标签{einstein}
没有与任何数字关联。我该如何修复它?我确信我创建 .bib 文件的方式是错误的,但显然 Latex 不会指出错误。如果我尝试输入未定义的 .bib 文件,例如,\addbibresource{blabla.bib}
我得到的输出完全相同。发生了什么?