[Tex/LaTex] Bibliography in Texmaker

bibliographiestexmaker

I'm having some problems with my bibliography in Texmaker.
My code is:

\documentclass[11pt, a4paper]{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{natbib}
\usepackage[utf8]{inputenc}    
\usepackage{natbib}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}

....

\cite{Johnson}
\bibliographystyle{plain}
\bibliography{mybib}

\end{document}

I also created a new file (File > New) that I saved as mybib.bib:

@Article{Johnson,
author = {Edgar G. Johnson and Alfred O. Nier},
title = {Angular Aberrations in Sector Shaped Electromagnetic Lenses for Focusing Beams of 
Charged Particles},
journal = {Physical Review},
year = {1953},
volume = {91},
number = {1},
}

@phdthesis{Zoran,
author = {Zoran Racic},
title = {\'Etude et essais du spectromètre à plasma {DYMIO} de la  mission {MARS 96}},
publisher = {Université Pierre et Marie Curie},
year = {1996}
}

When I compile my .tex file, I only have a [?] appearing.

Could you tell me what my mistake is?

Best Answer

Your problem is that, after running pdflatex (or latex or whatever else) and bibtex (if you did it), you have to run pdflatex twice afterwards to get your document fully compiled.

In TeXMaker, if you want to be able to perform the full compilation cycle and view your finished .pdf file by just pressing F1, you can configure your 'Quick Build' command, choosing the wizard in the 'Configure TeXMaker' -> 'Quick Build' dialog, and adding, in the following sequence:

PdfLaTeX

Bibtex

PdfLaTeX

PdfLaTeX

Pdf Viewer

If you want to use a different engine, substitute pdflatex with your preferred one. If the one is latex also substitute Pdf Viewer with Dvi Viewer in the above sequence.

Related Question