5

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}
\addbibresource{biblio.bib}
\begin{document}

\section{Chapter One}
\refsection
This is Chapter One.
\cite{goossens93}, \cite{lamport94}, \cite{rahtz89} 
\printbibliography[heading=subbibliography]
\endrefsection

\newpage
\section{Chapter Two}
\refsection
This is Chapter Two.
\cite{lamport94}
\printbibliography[heading=subbibliography]
\endrefsection

\newpage
\section{Chapter Three}
\refsection
This is Chapter Three.
\cite{greenwade93}, \cite{patashnik88}, \cite{knuth79}
\printbibliography[heading=subbibliography]
\endrefsection

\end{document}

New MWE:

\documentclass{beamer}
\usepackage{biblatex}
\addbibresource{biblio.bib}
\begin{document}


\section{Chapter One}
\refsection
\begin{frame}
This is Chapter One.
\cite{goossens93}, \cite{lamport94}, \cite{rahtz89} 
\printbibliography[heading=subbibliography]
\end{frame}
\endrefsection

\section{Chapter Two}
\refsection
\begin{frame}
This is Chapter Two.
\cite{lamport94}
\printbibliography[heading=subbibliography]
\end{frame}
\endrefsection

\section{Chapter Three}
\refsection
\begin{frame}
This is Chapter Three.
\cite{greenwade93}, \cite{patashnik88}, \cite{knuth79}
\printbibliography[heading=subbibliography]
\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",
    publisher = "Addison-Wesley",
    address = "Reading, Massachusetts"

}

@article{greenwade93, 
    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",
    address = "Stanford"
}

@book{lamport94,
    author = "Leslie Lamport",
    title = "Latex: A Document Preparation System",
    year = "1994",
    edition = "Second",
    publisher = "Addison-Wesley",
    address = "Reading, Massachusetts"
}

@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
3

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.

| improve this answer | |
1

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}
\addbibresource{biblatex-examples.bib}
\begin{document}

\begin{frame}
\section{Chapter One}
\begin{refsection}
This is Chapter One.
\cite{companion}, \cite{coleridge}, \cite{cicero} 
\printbibliography[heading=subbibliography]
\end{refsection}
\end{frame}

\begin{frame}
\section{Chapter Two}
\begin{refsection}
This is Chapter Two.
\cite{coleridge}
\printbibliography[heading=subbibliography]
\end{refsection}
\end{frame}

\begin{frame}
\section{Chapter Three}
\begin{refsection}
This is Chapter Three.
\cite{pines}, \cite{moraux}, \cite{knuth:ct:a}
\printbibliography[heading=subbibliography]
\end{refsection}
\end{frame}

\end{document}
| improve this answer | |
  • @moeve Take a look ate the new MWE. The problem persists. – S.V. Aug 5 '14 at 18:58
1

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.

| improve this answer | |
  • 4
    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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.