# How to use the Multi Bibliography resource from biblatex with beamer?

I am working with beamer and biblatex. I am writing a series of lectures and I want each one of them to have a separate bibliographical reference. I am running

pdflatex foo.tex
biber foo.bcf
pdflatex foo.tex


After that, something strange happens. If I run pdflatex foo.tex I get the following error message:

Package biblatex Error: Nested 'refsection' environment.


If I change the document class from beamer to article, everything works fine. The question is: How to fix this error?

EDIT: I added a new MWE to illustrate what I want to do.

The MWE: foo.tex

\documentclass{beamer}
\usepackage{biblatex}
\begin{document}

\section{Chapter One}
\refsection
This is Chapter One.
\cite{goossens93}, \cite{lamport94}, \cite{rahtz89}
\endrefsection

\newpage
\section{Chapter Two}
\refsection
This is Chapter Two.
\cite{lamport94}
\endrefsection

\newpage
\section{Chapter Three}
\refsection
This is Chapter Three.
\endrefsection

\end{document}


New MWE:

\documentclass{beamer}
\usepackage{biblatex}
\begin{document}

\section{Chapter One}
\refsection
\begin{frame}
This is Chapter One.
\cite{goossens93}, \cite{lamport94}, \cite{rahtz89}
\end{frame}
\endrefsection

\section{Chapter Two}
\refsection
\begin{frame}
This is Chapter Two.
\cite{lamport94}
\end{frame}
\endrefsection

\section{Chapter Three}
\refsection
\begin{frame}
This is Chapter Three.
\end{frame}
\endrefsection
\end{document}


The bibliography file is: biblio.bib

@book{goossens93,
author = "Michel Goossens and Frank Mittlebach and Alexander Samarin",
title = "The Latex Companion A",
year = "1993",

}

author = "George D. Greenwade",
title = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
year = "1993",
journal = "TUGBoat",
volume = "14",
number = "3",
pages = "342--351",
url=" www.ctan.org"
}

@book{knuth79,
author = "Donald E. Knuth",
title = "Tex and Metafont, New Directions in Typesetting",
year = "1979",
publisher = "American Mathematical Society and Digital Press",
}

@book{lamport94,
author = "Leslie Lamport",
title = "Latex: A Document Preparation System",
year = "1994",
edition = "Second",
}

@misc{patashnik88,
author = "Oren Patashnik",
title = "{B}ib{T}e{X}ing.  Documentation for General {B}ib{T}e{X} users",
year = "1988",
howpublished = "Electronic document accompanying BibTeX
distribution"
}

@techreport{rahtz89,
author = "Sebastian Rahtz",
title = "A Survey of {T}ex and graphics",
year = "1989",
institution = "Department of Electronics and Computer Science",
address = "University of Southampton, UK",
number = "CSTR 89-7"
}

• Mhh... the problem seems to lie with the .nav file created by beamer which contains some lines about \defcounter {refsection}{0}\relax . That seems to upset biblatex quite a bit. I have as of no no idea how to prevent beamer from doing that. (One can manually delete these lines and the compilation will work, but obviously that is not a viable solution.) – moewe Aug 5 '14 at 14:14
• @moewe Your code in the deleted answer works fine for me. You have just to delete the old .nav file. – karlkoeller Jan 14 '15 at 12:07

I had the same problem and solved it by using refsegment instead of refsection. To print the partial bibliography corresponding to a particular refsegment environment you must specifically specify it in the printbibliography command. For example:

\printbibliography[segment=2]


prints the bibliography from the second refsegment environment. It is not enough to just put \printbibliography in the corresponding refsegment environment (as can be done when using refsection).

See Section 3.11.3 in the manual for biblatex for more detail.

If you use the proper beamer way of getting a new frame, which is not \newpage but wrapping the contents of one frame into one \begin{frame}...\end{frame} environment, everything works rather fine.

In response to your update: If you use \section outside of a frame, this causes trouble with your \refsections. You need to place the \section command in a frame.

\documentclass{beamer}
\usepackage{biblatex}
\begin{document}

\begin{frame}
\section{Chapter One}
\begin{refsection}
This is Chapter One.
\cite{companion}, \cite{coleridge}, \cite{cicero}
\end{refsection}
\end{frame}

\begin{frame}
\section{Chapter Two}
\begin{refsection}
This is Chapter Two.
\cite{coleridge}
\end{refsection}
\end{frame}

\begin{frame}
\section{Chapter Three}
\begin{refsection}
This is Chapter Three.
\cite{pines}, \cite{moraux}, \cite{knuth:ct:a}
\end{refsection}
\end{frame}

\end{document}

• @moeve Take a look ate the new MWE. The problem persists. – S.V. Aug 5 '14 at 18:58

I had the same problem, but solved it different. I just removed one biblatex-package option from the LaTeX root file. This is what I had:

% Code causing "nested refsection errors"
\documentclass[...]
\usepackage{...}
\usepackage[style=alphabetic, refsection=chapter, backend=biber]{biblatex}
.
.
\begin{document}
.
.
\begin{refsection}
.
.
\printbibliography
\end{refsection}
.
.
\end{document}


After removing the refsection=chapter option, results where as expected. So, for me, this worked:

% Correct Code
\documentclass[...]
\usepackage{...}
\usepackage[style=alphabetic, backend=biber]{biblatex}
.
.
\begin{document}
.
.
\begin{refsection}
.
.
\printbibliography
\end{refsection}
.
.
\end{document}


I can image that the refsection=chapter option auto inserts refsections in the chapters and became nested refsections with the manually inserted ones.

• That is indeed the case. With refsection=chapter every \chapter starts a new refsection automatically. The OP did not have this problem since their code does not contain refsection=chapter. – moewe Sep 20 '17 at 7:41