Actual Problem

The issue that I'm actually trying to resolve is that TeXstudio gives me Citation 'mykey' on page 9 undefined (more about the error in the appendix below). I'm however not bound to TeXstudio but believe that the problem lies somewhere else/below.

Research so far

This seems to be a related question. Following the suggestions in the accepted answer, I ran the bibliography module (bibtex.exe), which leads to this error: I couldn't open file name 'titlesec.aux'.

Looking for a way to tackle this (I found almost nothing), I tried this MWE which is provided here:

%File mb-bibtex.tex, then \jobname = mb-bibtex
\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
  author    = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
  title     = {The LaTeX Companion},
  edition   = {1},
  publisher = {Addison-Wesley},
  location  = {Reading, Mass.},
  year       = {1994}
  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}

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

I compiled it from console and also using TeXworks. After pressing ENTER to forward from this error output:

! 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

a .pdf is generated, but it still lacks correct quoting. The previous output in TeXstudio was something like foo[mykey] bar, now I get [? ]:Wrong Quotation like [? ]

Coming from the comments section ibidem, this question here arises.

Installed versions:

  • TeXstudio 2.12.2 (Qt-Version 5.6.2)
  • TeXworks 0.6.5 (MiKTeX 20.7)
  • first line of 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 (should not be relevant)
  • 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


Full error that is tooltipped while hovering over a simple \cite{mykey}

Zitat fehlt: 

(engl.: ~"Quotation missing").

  • If your latex installation is up to date the filecontents env is now build in. Your problem goes away for me if I remote that comment after \begin{filecontents*}{\jobname.bib.
    – daleif
    Aug 19, 2020 at 14:23
  • TIP: If you use the new latex then one can use \begin{filecontents*}[overwrite]{\jobname.bib} then the bib file is overwritten each time, thus you vcan make changes to it in the filecontents env and it will be added to the .bib file. Normally, if the file already exists, latex will leave it alone
    – daleif
    Aug 19, 2020 at 14:24
  • You seem to have missed the last two lines when you copied the MWE: \bibliography{\jobname} and \end{document} are missing. If I remove the problematic comment % writing file \jobname.bib in the filecontents environment, things work for me. Can you please make these changes, run the example in a new, empty folder and edit your question accordingly?
    – moewe
    Aug 21, 2020 at 15:04
  • 1
    The message I couldn't open file name 'titlesec.aux' sounds a bit odd. It either suggests that you are calling BibTeX on titlesec.sty (presumably because your editor has focus on titlesec.sty and not your main .tex document) or that your .tex file is called titlesec.tex (which should be avoided: I have seen some weird side-effects when people used the name of a common package for their .tex file. Call it cadoizdoc.tex and try again.).
    – moewe
    Aug 21, 2020 at 15:07
  • @moewe Sorry, you're absolutely right. I missed the scrollbar and didn't include the last two lines in the question. Edited the question accordingly.
    – Cadoiz
    Aug 25, 2020 at 2:49


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.