[Tex/LaTex] Biblatex, Biber, and LaTeX: citations undefined

biberbiblatextexstudio

I get "There were undefined references" errors and can't fix it after two days of trying. I have tried switching editors from Sublime Text 3 to TeXStudio on a Mac, then trying both on a PC. I am willing to try anything at this point.

My test.tex file:

\documentclass{article}
\usepackage[style=numeric,backend=biber]{biblatex}
\addbibresource{\Username\Dropbox\test.bib}
\begin{document}
  Hello\cite{greenwade93}.
  \printbibliography
\end{document}

My test.bib file:

@ARTICLE{greenwade93,
  author  = "George Greenwade",
  title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
  year    = "1993",
  journal = "TUGBoat",
  volume  = "14",
  number  = "3",
  pages   = "342--351"
}

The pdf shows:
Hello[greenwade93 ]

TeXStudio log shows the following errors:

"Citation 'greenwade93' on page 1 undefined.
"Empty bibliography"
"There were undefined references"
"Please (re)run Biber on the file:(biblatex)test(biblatex) and rerun LaTeX afterwards.

I have read about doing a compilation trick but I'm not sure how to do this in either SublimeText or TexStudio. I don't know how to use command line. I have run into many problems and taken many detours that led to other problems. I'm at a loss. Can someone please give me a few hints or keywords I can search for to fix these problems, or a complete solution? I can't even get a minimum working example up. I will install anything.

Best Answer

TeXstudio's build process ('Build & View') by default runs pdfLaTeX but not a bibliography tool, which you need to do separately. There is also a need to change the settings to run Biber rather than BibTeX for creating a bibliography. Thus the steps required are as follows:

  1. In the TeXstudio preferences ('Preferences ...' on the Mac or 'Options -> Configure TeXstudio' on Windows), choose the Build tab and alter the 'Default Bibliography' to 'Biber'. Save and close the preferences.

  2. Run 'Build & View' from the 'Tools' menu (or press the two green arrows icon), which will create a PDF but with the bibliography not completed

  3. Run 'Bibliography' from the 'Tools' menu.

  4. Run 'Build & View' again: the bibliography will appear in the PDF.

As noted in comments, it is possible to set up TeXstudio in alternative ways to achieve the same effect. The key is that you have to ensure that the is a sequence

  1. LaTeX
  2. Biber
  3. LaTeX

which can be done 'by hand' (as I have) or can be automated in various ways. Note that the same general idea applies whatever editor is used: this is a feature of LaTeX and not of the editor.


On the question of file paths (a separate issue), it is best not to include a path at all but to place the .bib file where it will be 'found': in the current difrectory or somewhere that TeX searches automatically. That is a separate issue, so I'm assuming a demo file reading:

\documentclass{article}
\begin{filecontents*}{\jobname.bib}
@ARTICLE{greenwade93,
  author  = "George Greenwade",
  title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
  year    = "1993",
  journal = "TUGBoat",
  volume  = "14",
  number  = "3",
  pages   = "342--351"
}
\end{filecontents*}
\usepackage[style=numeric,backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
  Hello\cite{greenwade93}.
  \printbibliography
\end{document}

which 'rolls up' the BibTeX database into the LaTeX source.

Related Question