我正在编写论文文档的参考书目,并使用 XeTex 和 JabRef。当我编译代码时,即使在编译两次代码后,超链接的位置仍然会出现一个问号。我已将以下 2 个包添加到类文件中:
\RequirePackage{natbib}
\RequirePackage{cite}
在主 .tex 文件中,在结束文档之前我放置了以下 2 个命令:
\bibliographystyle{plainnat}
\bibliography{thesis}
我使用 texmaker 作为编辑器。jabref 中的 .bib 文件包含以下代码:
@Article{einstein,
Title = {{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]},
Author = {Albert Einstein},
Journal = {Annalen der Physik},
Year = {1905},
Number = {10},
Pages = {891--921},
Volume = {322},
Doi = {http://dx.doi.org/10.1002/andp.19053221004}
}
我不确定我在包含 bib 文件或编译代码时是否犯了错误。请告诉我我应该提供哪些其他信息来帮助找到此问题的解决方案。
其最低工作代码为:
\documentclass{report}
\usepackage{fontspec}
\usepackage{cite}
\usepackage{natbib}
\begin{document}
\title{test}
\author{test}
\maketitle
\tableofcontents{}
\listoffigures
\listoftables
\bibliographystyle{plainnat}
\bibliography{thesis}
\section{Author's Message}
Howdy! This is my honor to organize the LATEX Thesis Template
\section{Reference usage and example}
This subsection test the usage of Reference. Paper \cite{einstein} is referred in this way.
\end{document}
答案1
你在你的帖子中忘记加载hyperref
(作为最后一个包加载,这是一般规则——尽管也有一些例外)。这些代码对我来说运行良好:
\documentclass{report}
\usepackage{fontspec}
\usepackage{cite}
\usepackage{natbib}
\usepackage{filecontents}
\begin{filecontents}{thesis.bib}
@Article{einstein,
Title = {{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]},
Author = {Albert Einstein},
Journal = {Annalen der Physik},
Year = {1905},
Number = {10},
Pages = {891--921},
Volume = {322},
Doi = {http://dx.doi.org/10.1002/andp.19053221004}
}
\end{filecontents}
\usepackage[colorlinks]{hyperref}
\begin{document}
\title{test}
\author{test}
\maketitle
\tableofcontents{}
\listoffigures
\listoftables
\bibliographystyle{plainnat}
\bibliography{thesis}
\newpage
\section{Author's Message}
Howdy! This is my honor to organize the LATEX Thesis Template
\section{Reference usage and example}
This subsection test the usage of Reference. Paper \cite{einstein} is referred in this way.
\end{document}