2

Today Overleaf behaving weird and I am not getting what's wrong in citation and references. I tried a very simple one line code, but getting error. Please let me know what's wrong in my .tex and .bib file

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amssymb,amsthm}

\begin{document}
Einsteins stated the \cite{einstein}
\bibliography{sample.bib}
\end{document}

And here is my sample.bib

@article{einstein,
    author = "Albert Einstein",
    title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
    [{On} the electrodynamics of moving bodies]",
    journal = "Annalen der Physik",
    volume = "322",
    number = "10",
    pages = "891--921",
    year = "1905",
    DOI = "http://dx.doi.org/10.1002/andp.19053221004",
    keywords = "physics"
}

1 Answers1

1

Two problems:

  • you must set a bib style with \bibliographystyle{...}

  • don't add a file type in \bibliography{...}


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
    
\begin{document}
Einsteins stated the \cite{einstein}
\bibliographystyle{plain}
\bibliography{sample}
\end{document}

enter image description here