3

I'm getting a Citation 'test' on page 1 undefined on input line 6. error for the below example on Overleaf.

I've looked at many other questions and I can't find the error. Any ideas?

\documentclass{article}
\usepackage{biblatex}

\begin{document}

\cite{test}

\begin{thebibliography}{99} \bibitem{test} bibtest \end{thebibliography}

\end{document}

envyul
  • 33
  • 5
  • Don't load biblatex, if you use a manual thebibliography environment to make your bibliography. – cabohah May 11 '23 at 05:37
  • 1
    I agree that https://tex.stackexchange.com/q/630571/35864 is basically the same problem, but the question here is so much clearer (with a much better MWE) that it might be better to leave this one here open. – moewe May 11 '23 at 08:11
  • 1
    I agree with @moewe that this question is more clear. I suggest we close the older question as a duplicate of this one. Maybe moewe as a gold badge holder could do that? – Marijn May 11 '23 at 15:49

2 Answers2

4

biblatex requires another data format with\refsection, \datalist, \entry and \field etc., but not a thebibliography environment with \bibitem. So loading package biblatex but using a thebibliography environment — either manually edited or created by bibtex with another document — does not work.

In other words: You cannot mix the package with a manually created thebibliography environment. Instead you should use a bib file and run biber:

\documentclass{article}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document}

Test: \cite{aksin}, \autocite{aksin}, \parencite{aksin}, \footcite{aksin} (the last one is nonsense with the default cite style, but could be useful, e.g., with \texttt{cite=authoryear} option).

\printbibliography

\end{document}

or manually:

\documentclass{article}

\begin{document}

\cite{test}

\begin{thebibliography}{99} \bibitem{test} bibtest \end{thebibliography}

\end{document}

If you are interesting in converting an already existing thebibliography environment into a bib file, see: Convert from a textplain reference to bibtex.

cabohah
  • 11,455
0

As caboah told you, your MWE works without biblatex:

\documentclass{article}

\begin{document}

\cite{test}

\begin{thebibliography}{99} \bibitem{test} bibtest \end{thebibliography}

\end{document}

enter image description here

If you would like to use biblatex, you have to create a .bib file, for example mybib.bib:

@article{test,
    title={This is a test},
    author={Paulinho, van Duck},
    journal={Quack University Journal},
    volume={10},
    pages={16--30},
    date={2023-03-11},
    url={https://www.quackforyou.com}
}  

and then add it to your document with \addbibresource{mybib.bib}:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{csquotes}

\usepackage{biblatex} \usepackage{xurl} \usepackage{hyperref}

\addbibresource{mybib.bib}

\begin{document} \cite{test}

\printbibliography \end{document}

enter image description here

CarLaTeX
  • 62,716