[Tex/LaTex] Using bib files in Latex – path definition

bibtexmiktex

I am relatively new to latex and I am puzzled by the way citations work. I used Mendeley to generate a bib-file with all my references in it but I am having trouble using citations in my text.

What I do is this:

\documentclass{article}
\usepackage[utf8]{inputenc}
\bibliography{C:/Users/PC/Documents/biblio}

\begin{document}
\maketitle
Please insert a citation here \cite{Ross2010}

\end{document}

I use MikTex and typeset with pdfLaTex+MakeIndex+BibTex and I used Mendeley to create a large .bib file with all my references in for me to reference in the beginning of the document but when I check, it doesn't recognize any of the references in the list and just write "?" in the pdf.

What am I missing?

Best Answer

A corrected example would be the following:

\documentclass{article}
\usepackage[utf8]{inputenc}

\begin{document}
Please insert a citation here \cite{<key>}

\bibliographystyle{unsrt}
\bibliography{<filename>}

\end{document}

Where you need to replace and by the corresponding values. Please note the following changes I made: \bibliography has to be inside your document (not in the preamble) where you want your list of references to appear. Additionally, you need a \bibliographystyle command to tell the compiler what style your bibliography should have. There are severaly styles available from which you can choose. (For more styles there are also packages like natbib which might come in handy).

Customizing a bibtex style is also possible, but I personally would recommend to use biblatex instead, as it is easier to customie and more flexible. A MWE for biblatex would look like the following:

This example must be compiled using latex, biber, latex, latex.

\documentclass{article}

\usepackage{biblatex}
\addbibresource{<filename.bib>}

\begin{document}
\cite{<key>}
\printbibliography
\end{document}

For a more in depth explanation, please have a look at thie excellent answer: https://tex.stackexchange.com/a/25702/134144