因此,我尝试使用 biblatex 包,但到目前为止,我无法将引文或参考书目正确打印到 PDF 上。这是我的 .bib 文件:
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",
keywords = "latex,knuth"
}
@inbook{knuth-fa,
author = "Donald E. Knuth",
title = "Fundamental Algorithms",
publisher = "Addison-Wesley",
year = "1973",
chapter = "1.2",
keywords = "knuth,programming"
}
...
这是我的 .tex 文件:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
%\usepackage{csquotes}% Recommended
%\usepackage[style=authoryear-ibid,backend=biber]{biblatex}
\usepackage{comment}
\usepackage[backend=biber,style=authoryear,sorting=ynt]{biblatex}
\addbibresource{ref.bib}
%\usepackage{natbib}
\usepackage{bibentry}
\title{Bibliography management: \texttt{biblatex} package}
\author{\LaTeX}
\date{ }
\begin{document}
\maketitle
\section{First section}
\begin{enumerate}
\item A citation command in parentheses: \parencite{einstein}.
\item A citation command for use in the flow of text: As \textcite{Smith:2013jd} said \dots
\item A citation command which automatically switches style depending on location and the option setting in the package declaration (see line 12 in the LaTeX source code). In this case, it produces a citation in parentheses: \autocite{Other:2014ab}.
\end{enumerate}
\medskip
\nocite{*}
\printbibliography
\end{document}
其结果如下:
答案1
代码本身没有问题。但是运行后pdflatex <yourfile>
你需要调用 BibLaTeX 后端。在本例中是 Biber: biber <yourfile>
。然后,你需要pdflatex <yourfile>
再次运行,直到输出不再建议再次运行它。
biblatex 包甚至在第一次 pdflatex 调用的输出中写道:
Package biblatex Warning: Please (re)run Biber on the file:
(biblatex) yourfile
(biblatex) and rerun LaTeX afterwards.