如何在 beamer 中为每个讲座添加单独的 bibtex 书目?

如何在 beamer 中为每个讲座添加单独的 bibtex 书目?

我正在为课程做讲义,我想使用 includeonlylecture 为每周制作一组单独的幻灯片。

我使用 bibtex 进行引用,如果每组幻灯片都包含自己的参考书目,那就最好了。有没有什么优雅的方法可以做到这一点?

谢谢,并致以最诚挚的问候,CB

答案1

使用 bibtex 是强制性的吗?我之所以问,是因为 biblatex 提供了所谓的“refsections”,可用于为文档的各个部分编译单独的参考书目。下面是一个非常简单的 MWE,说明了其功能。

关键是使用 来\newrefsection告诉 biblatex 在哪里将文档拆分为与参考书目相关的子部分。然后,您可以使用\printbibliography可选参数将其限制为某个参考部分。

\printbibliography[section=1,heading=Lecture1]

我添加了另一个可选参数来自定义子书目的标题。可以使用以下命令进行自定义。

 \defbibheading{Lecture1}{\frametitle{References for Lecture 1}}

我将名称放入,\frametitle{…}因为我假设您希望它出现在框架的标题中。但您基本上可以使用任何您想要的代码(例如\section{My bib head})。

我将参考书目放在各个章节的末尾,但你也可以将它们全部放在末尾。

\documentclass{beamer}
\usepackage[style=authoryear,backend=bibtex]{biblatex}
\bibliography{bib}

\begin{document}

\defbibheading{Lecture1}{\frametitle{References for Lecture 1}}
\defbibheading{Lecture2}{\frametitle{References for Lecture 2}}

\lecture{Quiet}{Week 1} \newrefsection
    \begin{frame}
        \cite{Smith1997}
    \end{frame}    
    \frame{\printbibliography[section=1,heading=Lecture1]}

\lecture{Loud}{Week 2} \newrefsection  
    \begin{frame}{}
        \cite{Doe2001}
    \end{frame}    
    \frame{\printbibliography[section=2,heading=Lecture2]}

\end{document}

这是我在本例中使用的 bib 条目。将其保存为书目目录

@article{Smith1997,
    Author = {Smith, Elliot},
    Journal = {Singer and Songwriter},
    Title = {Eithe/Or},
    Volume = {23},
    Year = {1997}}

@article{Doe2001,
    Author = {Converge},
    Journal = {Hardcore and Metal},
    Volume = {19},
    Title = {Jane Doe},
    Year = {2001}}

相关内容