我似乎在 TeXmaker 中引用时遇到了问题。代码大致如下:
%%% citations
\usepackage{natbib}
\bibliographystyle{plain}
%stuff
\begin{document}
\maketitle
\section{Proposed Work}
\subsection{A subsection}
More text.
\cite{test} \citet{viegas} \citep{asd}
\bibliography{E:/all_lit}
\end{document}
E:/all_lit.bib 大致如下所示:
@InProceedings{viegas,
author = {Viegas, Gisela and Urbancic, Ted and Baig, Adam and von Lunen, Eric},
title = {Rupture dynamics and source scaling relations of microseismic hydraulic fractures in shale reservoirs},
booktitle = {Proceedings of the 13th International ISRM Congress 2015},
year = {2015},
}
@Article{test,
author = {poo},
title = {poo1},
journal = {poo2},
year = {2000},
}
@Book{asd,
author = {rr},
ALTauthor = {aa},
ALTeditor = {ss},
title = {ddd},
publisher = {qwe},
year = {2000},
}
我将快速构建设置为 PdfLatex + Bibtex + PdfLatex x2 + 查看 PDF,并将 Bibtex 构建设置为 bibtex build/%,因为它之前没有引用正确的文件。我得到一个 .bbl 文件,其中包含
\begin{thebibliography}{1}
\bibitem{test}
poo.
\newblock poo1.
\newblock {\em poo2}, 2000.
\bibitem{asd}
rr.
\newblock {\em ddd}.
\newblock qwe, 2000.
\bibitem{viegas}
Gisela Viegas, Ted Urbancic, Adam Baig, and Eric von Lunen.
\newblock Rupture dynamics and source scaling relations of microseismic hydraulic fractures in shale reservoirs.
\newblock In {\em Proceedings of the 13th International ISRM Congress 2015},
2015.
\end{thebibliography}
但是我仍然收到错误,第 3 页上的引用“test”未定义,引用为 [?]。这也适用于其他引用。如能提供帮助,我将不胜感激。
答案1
你的错误在于使用plain
而不是plainnat
:
\begin{filecontents*}{\jobname.bib}
@InProceedings{viegas,
author = {Viegas, Gisela and Urbancic, Ted and Baig, Adam and von Lunen, Eric},
title = {Rupture dynamics and source scaling relations of microseismic hydraulic fractures in shale reservoirs},
booktitle = {Proceedings of the 13th International ISRM Congress 2015},
year = {2015},
}
@Article{test,
author = {poo},
title = {poo1},
journal = {poo2},
year = {2000},
}
@Book{asd,
author = {rr},
ALTauthor = {aa},
ALTeditor = {ss},
title = {ddd},
publisher = {qwe},
year = {2000},
}
\end{filecontents*}
\documentclass{article}
\usepackage{natbib}
\bibliographystyle{plainnat}
%stuff
\begin{document}
\section{Proposed Work}
\subsection{A subsection}
More text.
\cite{test} \citet{viegas} \citep{asd}
\bibliography{\jobname}
\end{document}
请注意,我以前filecontents
只是不破坏我的文件。当然,使用你自己的文件。
答案2
显然,你的错误是在之前使用了样式文件\begin{document}
。此文件运行正常:
\documentclass[10pt]{amsart}
%% citations
\usepackage{natbib}
%stuff
\begin{document}
\section{Proposed Work}
\subsection{A subsection}
More text.
\cite{myref1} \citet{myref2}
\bibliographystyle{plain} % <- the new place
\bibliography{mybib}
\end{document}
第二次编辑:这是我的 TeX 文件上的确切代码:
\documentclass[10pt]{amsart}
\usepackage{natbib}
\begin{document}
\section{Proposed Work}
\subsection{A subsection}
More text.
\cite{aref2009optimal} --- \cite{aref2014ICRA}
\bibliographystyle{plain} % <- the new place
\bibliography{../bib/papers}
\end{document}
这是输出 + TeXStudio 用于该文件的编译器;
通过移动之前的样式文件,我仍然能够生成相同的错误 \begin{document}
。
答案3
我删除了所有构建文件并重新编译了整个文件,现在可以正常工作了。感谢大家的帮助!