有人能给我提供最小的工作代码,以便将文件中的引用添加.bib
到 LaTeX 文章中吗?我尝试了所有方法,但似乎都不起作用。.bib
我制作的最小文件的内容如下references.bib
:
%% This BibTeX bibliography file was created using BibDesk.
%% http://bibdesk.sourceforge.net/
%% Created for Jef Pauwels at 2015-10-05 14:24:21 +0200
%% Saved with string encoding Unicode (UTF-8)
@book{Giancoli,
Author = {Douglas C. Giancoli},
Date-Added = {2015-10-05 12:23:12 +0000},
Date-Modified = {2015-10-05 12:23:50 +0000},
Publisher = {Pearson},
Title = {Physics for Scientists & Engineers},
Year = {2014}}
答案1
嗯,你没有提到是否使用biblatex
and biber
。以下 MWE 适用于两者。
在您的 bib 文件中,您有一个错误:您应该&
在标题中用\
! 掩盖\&
,在您的文档中打印字母 &。
编译MWE:
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{Giancoli,
Author = {Douglas C. Giancoli},
Publisher = {Pearson},
Title = {Physics for Scientists \& Engineers},
Year = {2014},
Date-Added = {2015-10-05 12:23:12 +0000},
Date-Modified = {2015-10-05 12:23:50 +0000},
}
\end{filecontents}
\documentclass{article}
\usepackage[%
backend=biber,
style=authortitle,
sorting=nyt,
]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
Some \cite{Giancoli} text \autocite{Giancoli}.
\nocite{*}
\printbibliography
\end{document}
结果: