为什么参考文件无法在 TeX 文档中编译?

为什么参考文件无法在 TeX 文档中编译?

我使用的是 TexPad,两个文件都位于同一目录中。这是我的 TeX 文件:

\documentclass[12pt]{article}
\usepackage{latexsym}
\usepackage{amssymb,amsmath}
\usepackage{textcomp}
\usepackage{bbm}
\usepackage[pdftex]{graphicx}
\usepackage{framed}
\usepackage{gensymb}
\usepackage{hyperref}
\usepackage [english]{babel}
\usepackage [autostyle, english = american]{csquotes}
\MakeOuterQuote{"}

\begin{document}
HI

\bibliography{diy_biblio}


\end{document}

这是使用 Mendeley 创建的 diy_biblio.bib:

Automatically generated by Mendeley Desktop 1.14
Any changes to this file will be lost if it is regenerated by Mendeley.

BibTeX export options can be customized via Preferences -> BibTeX in Mendeley Desktop

@article{Menche2015,
author = {Menche, J. and Sharma, a. and Kitsak, M. and Ghiassian, S. D. and Vidal, M. and Loscalzo, J. and a.-L. Barabasi},
doi = {10.1126/science.1257601},
file = {:Users/hannahcatabia/Desktop/ordovas\_project/papers/menche/201502-19\_Science-Incomplete.pdf:pdf},
issn = {0036-8075},
journal = {Science},
number = {6224},
pages = {1257601--1257601},
title = {{Uncovering disease-disease relationships through the incomplete interactome}},
url = {http://www.sciencemag.org/cgi/doi/10.1126/science.1257601},
volume = {347},
year = {2015}
}

答案1

我删除了所有对于给定问题不必要的调用包。

但这里只是提示一下:调用包的顺序通常很重要,错误的顺序会导致错误。您调用了 packagesbabelcsquotespackages hyperref。大多数包应该在调用 之前调用hyperref

这就是我在 MWE 中按照正确的顺序使用这两个包的原因……

您没有引用任何 bib 条目,也没有使用命令\nocite{key}显示参考书目中未引用的 bib 条目(此处为条目key)或所有( )bib 条目。命令对测试给定文件中的错误条目有很大帮助...\nocite{*}\nocite{*}bib

我使用包filecontentstex代码和bib文件连接到一个 MWE 中。您的工作不需要它,它仅用于测试目的...

您没有告诉我们您使用哪种书目样式,因此我plain在这里使用标准样式。请将其更改为您需要的样式。

梅威瑟:

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{Goossens,
  author    = {Goossens, Michel and Mittelbach, Frank and 
               Samarin, Alexander},
  title     = {The LaTeX Companion},
  edition   = {1},
  publisher = {Addison-Wesley},
  location  = {Reading, Mass.},
  year      = {1994},
}
@Book{adams,
  title     = {The Restaurant at the End of the Universe},
  author    = {Douglas Adams},
  series    = {The Hitchhiker's Guide to the Galaxy},
  publisher = {Pan Macmillan},
  year      = {1980},
}
@article{Menche2015,
  author  = {Menche, J. and Sharma, a. and Kitsak, M. and Ghiassian, S. D. 
             and Vidal, M. and Loscalzo, J. and a.-L. Barabasi},
  doi     = {10.1126/science.1257601},
  file    = {:Users/hannahcatabia/Desktop/ordovas\_project/papers/menche/201502-19\_Science-Incomplete.pdf:pdf},
  issn    = {0036-8075},
  journal = {Science},
  number  = {6224},
  pages   = {1257601--1257601},
  title   = {{Uncovering disease-disease relationships through the incomplete interactome}},
  url     = {http://www.sciencemag.org/cgi/doi/10.1126/science.1257601},
  volume  = {347},
  year    = {2015},
}
\end{filecontents*}


\documentclass[12pt,a4paper]{article}

\usepackage{showframe}  % to visualise the typing area and margins

\usepackage[english]{babel}
\usepackage[autostyle,english=american]{csquotes}
\usepackage{hyperref}   % last package to be loaded here!

\begin{document}

This is text with \cite{Goossens} and \cite{adams}.

\nocite{*} % to test all bib entrys ==============================
\bibliographystyle{plain}
\bibliography{\jobname}

\end{document}

结果:

在此处输入图片描述

相关内容