I'm using biber and want to cite references inside a tikzpicture. I followed this answer that described how to do it with bibtex and it works nicely, but when switching to use biber, it doesn't work anymore:
\documentclass{article}
\usepackage{tikz}
\usepackage[backend=biber]{biblatex}
\begin{document}
\begin{tikzpicture}[show/.style={circle,draw}]
\node[show] (newpaper) at (0,2)
[label=right:{This 2011 paper ...}]
{\cite{newpaper}};
\node[show] (oldpaper) at (0,0)
[label=right:{This paper came out in 1900 ...}]
{\cite{oldpaper}};
\draw[->] (oldpaper) -- (newpaper);
\end{tikzpicture}
%\bibliographystyle{amsplain}
\begin{thebibliography}{10}
\bibitem{newerpaper}B. Becker, \emph{Even Newer Stuff}, 2012.
\bibitem{newpaper}C. Charles, \emph{New Stuff}, 2011.
\bibitem{oldpaper}H. Huckley, \emph{Old Stuff}, 1900.
\end{thebibliography}
\end{document}
Does anyone know of a solution without me having to switch to use bibtex?
UPDATE:
As noted by several below, my original code I posted was an easy fix. The actual bug I found was a result of my larger LaTeX code and I found the issue. Here's the updated code that has the issue:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=fig/]
\usepackage[backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{newerpaper,
author={B. Becker},
title={Even Newer Stuff},
date={2012}
}
@book{newpaper,
author={C. Charles},
title={New Stuff},
date={2011}
}
@book{oldpaper,
author={H. Huckley},
title={Old Stuff},
date={1900}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
%\tikzexternaldisable
\begin{tikzpicture}[show/.style={circle,draw}]
\node[show] (newpaper) at (0,2)
[label=right:{This 2011 paper ...}]
{\cite{newpaper}};
\node[show] (oldpaper) at (0,0)
[label=right:{This paper came out in 1900 ...}]
{\cite{oldpaper}};
\draw[->] (oldpaper) -- (newpaper);
\end{tikzpicture}
%\tikzexternalenable
\printbibliography
\end{document}
The problem is with the \tikzexternalize[prefix=fig/]
command. I got around this issue by adding \tikzexternaldisable
before the tikzpicture and \tikzexternalenable
after the tikzpicture.
Best Answer
As suggested in the comments, you should move to
biblatex
's way of dealing with the bibliography, rather than doing it by hand. E.g.:Which produces:
Edit: As it turned out, the issue is essentially one of the correct use of
biblatex
/biber
, and has little to do with TikZ, so a list of starters withbiblatex
could be handy:biblatex
's documentation