书目分别产生 [? ] 或 `我无法打开文件名‘titlesec.aux’`

书目分别产生 [? ] 或 `我无法打开文件名‘titlesec.aux’`

实际问题

我实际上试图解决的问题是 TeXstudio 给我的Citation 'mykey' on page 9 undefined(有关错误的更多信息,请参阅下面的附录)。然而,我并不局限于 TeXstudio,但我相信问题出在其他地方/下面。


迄今为止的研究

似乎是一个相关的问题。按照接受的答案,我运行了参考书目模块(bibtex.exe),导致了这个错误:I couldn't open file name 'titlesec.aux'

为了寻找解决这个问题的方法(我几乎什么也没找到),我尝试了这里提供的 MWE

%File mb-bibtex.tex, then \jobname = mb-bibtex
\documentclass{article}
\usepackage{filecontents}            % loading package filecontents 
\usepackage[numbers]{natbib}         % bibliography style
\usepackage[colorlinks]{hyperref}    % better urls in bibliography

\begin{filecontents*}{\jobname.bib}  % writing file \jobname.bib
@Book{companion,
  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}
}
\end{filecontents*}


\begin{document}
Test of bibliography: 
The funny book of Adams~\cite{adams}, the \LaTeX{} companion~\cite{companion}.

\bibliographystyle{plainnat}  % needs package natbib
\bibliography{\jobname}       % uses \jobname.bib, according to \jobname.tex
\end{document}

我是从控制台编译的,也使用了 TeXworks。按下ENTER前进后,出现了以下错误输出:

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.7 \begin{filecontents*}{\jobname.bib}
                                         % writing file \jobname.bib
?

生成了一个 .pdf,但仍然缺少正确的引用。TeXstudio 中的先前输出类似于foo[mykey] bar,现在我得到[? ]错误引用,如 [? ]

来自评论区同上,这个问题就在这里出现。


已安装的版本:

  • TeXstudio 2.12.2(Qt 版本 5.6.2)
  • TeXworks 0.6.5(MiKTeX 20.7)
  • 第一行texput.log

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.7) (preloaded format=pdflatex 2020.8.18) 19 AUG 2020 11:02

  • JabRef 5.0(不应相关)
  • pdflatex --version
MiKTeX-pdfTeX 4.0.1 (MiKTeX 20.7)
© 1982 D. E. Knuth, © 1996-2020 Hàn Thế Thành
TeX is a trademark of the American Mathematical Society.
using bzip2 version 1.0.6, 6-Sept-2010
compiled with curl version 7.61.1; using libcurl/7.61.1 WinSSL
compiled with expat version 2.2.6; using expat_2.2.6
compiled with jpeg version 9.3
compiled with liblzma version 50020042; using 50020042
compiled with libpng version 1.6.37; using 1.6.37
compiled with libressl version LibreSSL 2.8.2; using LibreSSL 2.8.2
compiled with MiKTeX Application Framework version 4.0; using 4.0
compiled with MiKTeX Core version 4.0; using 4.0
compiled with MiKTeX Archive Extractor version 4.0; using 4.0
compiled with MiKTeX Package Manager version 4.0; using 4.0
compiled with poppler version 0.60.1
compiled with uriparser version 0.9.2
compiled with zlib version 1.2.11; using 1.2.11

附录:

鼠标悬停在简单错误提示上时,会显示完整的错误信息 \cite{mykey}

Zitat fehlt: 
mykey

(英语:~“缺少引文”)。

相关内容