1

I read a lot of posts about this topic (Question mark or bold citation key instead of citation number, Latex references and bibliography not working etc), but they don't meet the needs. I followed the istructions:

https://sites.google.com/site/latexiseasy/bibliography

I created the code:

\documentclass{article}
\begin{document}

To achieve incentive compatibility, the auction winner has to pay the second highest price \cite{Vickrey1961}.

A good introduction to graph algorithms can be found in \cite{Golumbic2004}.

\bibliographystyle{plain}
\bibliography{mylib}

\end{document}

and the file mylib.bib:

@ARTICLE{Vickrey1961,
AUTHOR = {W. Vickrey},
TITLE = {Counterspeculation, auctions and sealed tenders},
JOURNAL = {Journal of Finance},
YEAR = {1961},
volume = {16},
pages = {8--37},
} 

@BOOK{Golumbic2004,
AUTHOR = {M. C. Golumbic},
TITLE = {Algorithmic Graph Theory and Perfect Graphs},
PUBLISHER = {Elsevier Science},
YEAR = {2004},
edition = {2nd Edition},
}

The bibliography does not appear. How can I fix it?


EDIT: when I click on play, it does not work.

enter image description here

I compile clicking on play in Texmaker:

enter image description here

Thank you very much.

  • Did you run it with LaTeX -> bibtex -> LaTeX -> LaTeX? – Skillmon Aug 16 '18 at 17:15
  • Hello @Skillmon can you explain what I have to do please? I compiled the main file in which there is the bibliography's call. – Gennaro Arguzzi Aug 16 '18 at 17:16
  • You have to also run a program called bibtex on the file and after that two additional runs of LaTeX. So if you're file is called myfile.tex and you're working in a terminal, you should type pdflatex myfile.tex after that's finished bibtex myfile and after that two additional times pdflatex myfile.tex. After that everything should be there. (Of course you can also use lualatex or xelatex instead of pdflatex) – Skillmon Aug 16 '18 at 17:18
  • Did this fix your issue? – Skillmon Aug 16 '18 at 17:38
  • @Skillmon unfortunately it still does not work. – Gennaro Arguzzi Aug 16 '18 at 17:52
  • Could you describe how you compile it? For me the above mentioned steps work. – Skillmon Aug 16 '18 at 18:18
  • @GennaroArguzzi you need to run bibtex on the template.tex file, not the .bib file. when you do, do you get any errors? any .blg file generated? – Troy Aug 16 '18 at 19:59
  • Hello @Troy, the problem is that the compiler works correctly without any error. I found a similar template on ShareLatex and here it works: https://www.sharelatex.com/templates/bibliographies/bibtex-template. I'm using Texmaker. – Gennaro Arguzzi Aug 17 '18 at 08:12
  • The play button in Texmaker does only run LaTeX once. If I remember correctly, you'd have to press F11 to run BibTeX. Or there should be a Tools menu and there you'd press on BibTeX (the tools menu is named "Strumenti" in your language it seems). – Skillmon Aug 17 '18 at 08:19
  • @Skillmon your solution works correctly; the only foresight is to insert a space between the last character and the command cite{} – Gennaro Arguzzi Aug 17 '18 at 09:30

1 Answers1

4

For your bibliography you need to run BibTeX at least once after you ran LaTeX at least once. The correct building chain would be

  1. run LaTeX
  2. run BibTeX
  3. run LaTeX
  4. run LaTeX

In Texmaker the play button only runs LaTeX once by default. You can run BibTeX by clicking on Tools -> BibTeX (Strumenti -> BibTeX in your language). This is also applicable for TeXstudio.

Skillmon
  • 60,462