如何使用 biblatex 和 beamer 中的多书目资源?

如何使用 biblatex 和 beamer 中的多书目资源?

我正在与beamer和合作biblatex。我正在撰写一系列讲座,我希望每个讲座都有单独的参考书目。我正在运行

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

之后,发生了一些奇怪的事情。如果我运行,pdflatex foo.tex我会收到以下错误消息:

Package biblatex Error: Nested 'refsection' environment. 

如果我将文档类从 更改beamerarticle,则一切正常。问题是:如何修复此错误?

编辑:我添加了一个新的 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}

新 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}

参考书目文件是: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"
}

答案1

我遇到了同样的问题,并使用 refsegment 而不是 refsection 解决了该问题。要打印与特定 refsegment 环境相对应的部分参考书目,您必须在 printbibliography 命令中专门指定它。例如:

\printbibliography[segment=2]

从第二个 refsegment 环境打印参考书目。仅仅将 \printbibliography 放入相应的 refsegment 环境是不够的(使用 refsection 时可以这样做)。

有关更多详细信息,请参阅 biblatex 手册中的第 3.11.3 节。

答案2

我遇到了同样的问题,但解决方法不同。我只是从 LaTeX 根文件中删除了一个 biblatex-package 选项。这就是我所得到的:

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

删除 refsection=chapter 选项后,结果符合预期。所以,对我来说,这是有效的:

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

我可以想象 refsection=chapter 选项会自动在章节中插入 refsections,并与手动插入的 refsections 形成嵌套的 refsections。

答案3

如果您使用正确的beamer方法获取新框架,即\newpage把一个框架的内容包装到一个\begin{frame}...\end{frame}环境中,那么一切都会正常进行。

回应您的更新:如果您\section在框架外使用,这会给您带来麻烦\refsections。您需要将\section命令放在框架中。

\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}

相关内容