1

I have a problem with apa6, apacite, etc. In the process of creating a mwe, I ran across code here on this site as a mwe, but it doesn't work. When compiled (Texpad on a Mac, using Bibtex), it produces [?] as the citation.

Here's the code:

\documentclass{article}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
  @book{Knu86,
    author = {Knuth, Donald E.},
    year = {1986},
    title = {The \TeX book},
  }
\end{filecontents}

\begin{document}

Doesn't work. \cite{Knu86}

\bibliography{\jobname}
\end{document}

Thanks for any help on the mwe so I can post my real problem.

lockstep
  • 250,273
John Johnson
  • 381
  • 2
  • 10
  • after running latex, bibtex must run to produce a .bbl file, then latex twice more. (the first latex run puts the reference info into the log file for bibtex to use; bibtex creates the .bbl file, the first post-bibtex latex run reads the .bbl file and puts the biblio labels into the new .aux file, and the last latex run picks up these labels and resolves the \cites. with fewer runs of latex, in the proper sequence with bibtex, there isn't enough information to fill in the \cite info, and you get ?? instead.) – barbara beeton Apr 28 '13 at 03:32

1 Answers1

3

You also need a \bibliographystyle. And compile several times, like @barbarabeeton explained. This works:

\documentclass{article}

% Update 2022: Not needed anymore. %\usepackage{filecontents}

\begin{filecontents}{\jobname.bib} @book{Knu86, author = {Knuth, Donald E.}, year = {1986}, title = {The \TeX book}, } \end{filecontents}

\begin{document}

This works, yeah! \cite{Knu86}

\bibliographystyle{alpha} \bibliography{\jobname} \end{document}

Foo Bar
  • 13,247