# Biblatex, Biber, and LaTeX: citations undefined

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}
\begin{document}
\printbibliography
\end{document}


My test.bib file:

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


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.

-
First question: what exactly did you run? We can see you ran LaTeX (perhaps pdfLaTeX) at least once, but did you run Biber at all? – Joseph Wright Jan 12 '14 at 9:45
Thanks for the response JW, I've seen your posts everywhere. I don't know how to run Biber. I know it's installed on my computer. I can't find any guide online on how to run Biber. I'm new to LaTeX. – user2205916 Jan 12 '14 at 9:53
OK, I'll post some instructions for TeXstudio (assuming you are happy with that editor) – Joseph Wright Jan 12 '14 at 10:03
I'd be happy with any editor that worked utilizing Biblatex and Biber. I think I'd be able to figure out how to configure other editors to produce similar output if I could just get one to work. I found other instructions here: tex.stackexchange.com/questions/135102/… but my TeXStudio menu doesn't work in the same way and his instructions aren't explicit enough. – user2205916 Jan 12 '14 at 10:09
I may try to get something organised to cover how to deal with this for a range of editors: am raising in chat and will move to the meta site as needed. This is a challenging area for new users! – Joseph Wright Jan 12 '14 at 10:16

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}
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}
\begin{document}
\printbibliography
\end{document}


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

-
It worked! The simplicity of the solution is depressing. The detail of your answer will be very helpful to other neophytes like myself. Other answers assume a level of computer/LaTeX literacy not all have. – user2205916 Jan 12 '14 at 10:26
@user2205916 No problem: as I've said in a comment on the question, I think we probably need a more generalised question on this as for newer users it is a real challenge. – Joseph Wright Jan 12 '14 at 10:27
Valid point. I was worried about excessive localization. However, I think beginners have trouble implementing generalized answers within the context of their specific editors. I ran across the "pdflatex, biber, pdflatex" recommendation but knew not how to implement. Feel free to edit my original post for maximum relevance though. – user2205916 Jan 12 '14 at 10:39
@user2205916 I think Joseph probably has in mind a single question with a bunch of different answers for different editors. So the instructions would be specific to your editor - you'd just scroll down to find the relevant set. But there would be a single place to point people to when they run into this problem. (But I could be wrong about what he has in mind, obviously.) – cfr Jan 12 '14 at 21:00
@cfr That was what I was imagining, yes – Joseph Wright Jan 12 '14 at 21:52

To solve the same problem in Sublime Text 3:

1. Open the LaTeX.sublime-build file. Go to /User/username/Library/Application Support/Sublime Text 3/Packages/LaTeXTools/LaTeX.sublime-build. If you can't find your Library folder, you may have to un-hide it. Type the following into terminal: chflags nohidden ~/Library. Type chflags hidden ~/Library to re-hide.

2. Find the following block of code near the top of the file, under "osx":

"cmd": ["latexmk", "-cd", "-e", "\$pdflatex = '%E -interaction=nonstopmode -synctex=1 %S %O'", //"-silent", "-f", "-pdf"], 3. Make it look like this (only 3 lines are added): "cmd": ["latexmk", "latexmk", "biber", "latexmk", "-cd", "-e", "\$pdflatex = '%E -interaction=nonstopmode -synctex=1 %S %O'", //"-silent", "-f", "-pdf"],

4. Build using the same LaTeXTools system. It should now run pdflatex, biber, pdflatex, pdflatex in that order. Bibliography should be visible!

Update:

The alteration to the sublime-build file noted above was derived from a blog. It made my bibliography compile and prevented undefined citations. However, I updated all of my packages via TeXLiveUtility today, reverted back to the default sublime-build file calling 'latexmk' once, and compiled a working bibliography and citations just fine.

-