67

I am writing my thesis in Latex, and I have the references in an own thesis.bib file which look as follows

@Article{xxx,
  author =       "D.A. Reinhard",
  title =        "Case Study",
  year =         "1985",
}

and I reference them in my main document as ~\cite{xxx}

When I compile then the main document with: pdflatex main.tex than it shows me question marks instead of the proper references to the bibliography. Do I also need to compile the bib source on its own? If yes, can somebody please tell me the command for Linux

Many thanks!

4 Answers 4

88

You need to compile the bibtex file.

Suppose you have article.tex and article.bib. You need to run:

  • latex article.tex (this will generate a document with question marks in place of unknown references)
  • bibtex article (this will parse all the .bib files that were included in the article and generate metainformation regarding references)
  • latex article.tex (this will generate document with all the references in the correct places)
  • latex article.tex (just in case if adding references broke page numbering somewhere)
6
  • 4
    Also, consider using latex mk (phys.psu.edu/~collins/software/latexmk-jcc), a perl program that automatically runs whatever is needed (latex, bibtex, makeindex, etc.) in the correct order to produce an updated final document whenever you change something.
    – rcollyer
    Commented Mar 18, 2010 at 17:21
  • 1
    I strongly second that recommendation of latexmk. I couldn't live without it :) Commented May 14, 2010 at 18:47
  • 1
    I edited this answer because the bibtex command does not allow an extension. (and the extension would be ".aux" not ".tex" for it even if it did)
    – SO Stinks
    Commented Apr 26, 2011 at 0:19
  • 2
    Consider using pdflatex instead of latex to directly produce a .pdf file.
    – koppor
    Commented Oct 8, 2012 at 12:32
  • 1
    This answer does not answer the question as it asks specifically about using the pdflatex command.
    – ehsteve
    Commented Jan 28, 2014 at 15:09
23

You have to run 'bibtex':

latex paper.tex
bibtex paper
latex paper.tex
latex paper.tex
dvipdf paper.dvi
15

I am using texmaker as the editor. you have to compile it in terminal as following:

  1. pdflatex filename (with or without extensions)
  2. bibtex filename (without extensions)
  3. pdflatex filename (with or without extensions)
  4. pdflatex filename (with or without extensions)

but sometimes, when you use \citep{}, the names of the references don't show up. In this case, I had to open the references.bib file , so that texmaker could capture the references from the references.bib file. After every edition of the bib file, I had to close and reopen it!! So that texmaker could capture the content of new .bbl file each time. But remember, you have to also run your code in texmaker too.

1
  • instead of closing and opening the references.bib, you can also go to edit-->refresh bibliography. It works!! Commented Mar 6, 2019 at 16:28
7

Just in case it helps someone, since these questions (and answers) helped me really much; I decided to create an alias that runs these 4 commands in a row:

Just add the following line to your ~/.bashrc file (modify the main keyword accordingly to the name of your .tex and .bib files)

alias texbib = 'pdflatex main.tex && bibtex main && pdflatex main.tex && pdflatex main.tex'

And now, by just executing the texbib command (alias), all these commands will be executed sequentially.

1
  • why we have to run pdflatex main.tex two times?
    – Exploring
    Commented Aug 12, 2021 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.