65

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!

Tadeusz A. Kadłubowski
  • 8,047
  • 1
  • 30
  • 37
Klaus
  • 711
  • 1
  • 7
  • 4

4 Answers4

85

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)
gsamaras
  • 71,951
  • 46
  • 188
  • 305
Tadeusz A. Kadłubowski
  • 8,047
  • 1
  • 30
  • 37
  • 4
    Also, consider using latex mk (http://www.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 Mar 18 '10 at 17:21
  • 1
    I strongly second that recommendation of latexmk. I couldn't live without it :) – Damien Pollet May 14 '10 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 Apr 26 '11 at 00:19
  • 2
    Consider using `pdflatex` instead of `latex` to directly produce a .pdf file. – koppor Oct 08 '12 at 12:32
  • 1
    This answer does not answer the question as it asks specifically about using the pdflatex command. – ehsteve Jan 28 '14 at 15:09
  • Replacing 'latex' with 'pdflatex' works like a charm – Aart Goossens Jun 18 '14 at 10:50
22

You have to run 'bibtex':

latex paper.tex
bibtex paper
latex paper.tex
latex paper.tex
dvipdf paper.dvi
14

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.

mehmetseckin
  • 3,061
  • 1
  • 31
  • 43
user3015729
  • 191
  • 2
  • 7
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.

vabada
  • 1,738
  • 4
  • 29
  • 37