我喜欢将某一门课程的所有大学讲座和辅导幻灯片保存在一个文件中,因为这比为每个课程单独保存一个文件要省事得多,特别是因为我使用文章模式memoir
为自己和我的助教制作教科书。
然而,我发现第二个(或更多)\lecture
命令会干扰最后的参考书目的生成。
我尝试过其他人建议的各种方案(但没有成功)(例如,如何在 beamer 中为每个讲座添加单独的 bibtex 书目?) 但无论如何都已经根据实际的biblatex
示例文件拼凑了一个 MWE 来说明该问题。
不知为何,这个refsection
“s”似乎没有发挥作用。
对于讲义,我只想获取当前讲座的参考书目。使用我的memoir
模板,我想要所有内容:所有幻灯片和整个参考书目。目前,幻灯片经过了正确过滤,但参考书目是完整的,无论是否包含幻灯片。
我可以使用\include
文件来做到这一点,\includeonly
但如上所述,不想将事情分开。
梅威瑟:
% Handout version follows.
% Alternate header used for 'article' version.
\documentclass[t,ignorenonframetext,handout,hyperref={xetex,bookmarks,breaklinks,colorlinks,unicode,allcolors=blue}]{beamer}
\usetheme{Warsaw}
\usefonttheme{professionalfonts}
\setbeamertemplate{footline}[page number]{}
% Customize for handout mode
\setbeameroption{show notes}
\includeonlylecture{L1}
\usepackage{biblatex-chicago}
\addbibresource{biblatex-examples.bib}
% Main code common to presentation, handout, and article
\mode<all>{
\institute{Department of History\\Miskatonic University}
\title{Course title}
\author{Author}
}
\begin{document}
\begin{titlingpage}
\maketitle
\begin{abstract}
\noindent This course will bla-bla-bla.
\end{abstract}
\end{titlingpage}
\OnehalfSpacing
\frontmatter
\tableofcontents
\mainmatter
% LECTURE
\lecture[Lecture 1]{Syllabus and course introduction}{L1}
\chapter{C1}
\begin{refsection}
\mode<presentation>{%
\begin{frame}{HI999---Course title}
\date{6 Jan 2020}
\title{Syllabus and course introduction}
\maketitle
\end{frame}
}
\begin{frame}{Title}{Subtitle}
This is just filler text \parencite{massa}.
This is just filler text \parencite{augustine}.
This is just filler text \parencite{cotton}.
This is just filler text \parencite{hammond}.
\end{frame}
\begin{frame}[allowframebreaks]{Bibliography}
\printbibliography[heading=subbibliography]
\end{frame}
\end{refsection}
\clearpage
% LECTURE
\lecture[Lecture 2]{First real lecture}{L2}
\chapter{C2}
\begin{refsection}
\mode<presentation>{%
\begin{frame}{HI999---Course title}
\date{8 Jan 2020}
\title{First real lecture}
\subtitle{With subtitle}
\maketitle
\end{frame}
}
\begin{frame}{Title}{Subtitle}
This is just filler text \parencite{murray}.
This is just filler text \parencite{augustine}.
This is just filler text \parencite{cotton}.
This is just filler text \parencite{bertram}.
\end{frame}
\begin{frame}[allowframebreaks]{Bibliography}
\printbibliography[heading=subbibliography]
\end{frame}
\end{refsection}
\clearpage
\backmatter
\end{document}
答案1
作为卡巴的回答已经暗示了,\begin{refsection}
并且\end{refsection}
由于ignorenonframetext
选项而被忽略(因为它们出现在框架之外)。
通过包装\begin{refsection}
并\end{refsection}
放入
\mode<all>{...}
你可以确保它们始终被考虑在内beamer
。
\documentclass[t,ignorenonframetext,handout,
hyperref={bookmarks,breaklinks,colorlinks,unicode,allcolors=blue}
]{beamer}
\setbeameroption{show notes}
\includeonlylecture{L1}
\usepackage{biblatex-chicago}
\addbibresource{biblatex-examples.bib}
\mode<all>{
\institute{Department of History\\Miskatonic University}
\title{Course title}
\author{Author}
}
\begin{document}
\begin{titlingpage}
\maketitle
\begin{abstract}
\noindent This course will bla-bla-bla.
\end{abstract}
\end{titlingpage}
\OnehalfSpacing
\frontmatter
\tableofcontents
\mainmatter
% LECTURE
\lecture[Lecture 1]{Syllabus and course introduction}{L1}
\chapter{C1}
\mode<all>{\begin{refsection}}
\mode<presentation>{%
\begin{frame}{HI999---Course title}
\date{6 Jan 2020}
\title{Syllabus and course introduction}
\maketitle
\end{frame}
}
\begin{frame}{Title}{Subtitle}
This is just filler text \parencite{sigfridsson}.
\end{frame}
\begin{frame}[allowframebreaks]{Bibliography}
\printbibliography[heading=subbibliography]
\end{frame}
\mode<all>{\end{refsection}}
\clearpage
% LECTURE
\lecture[Lecture 2]{First real lecture}{L2}
\chapter{C2}
\mode<all>{\begin{refsection}}
\mode<presentation>{%
\begin{frame}{HI999---Course title}
\date{8 Jan 2020}
\title{First real lecture}
\subtitle{With subtitle}
\maketitle
\end{frame}
}
\begin{frame}{Title}{Subtitle}
This is just filler text \parencite{nussbaum}.
\end{frame}
\begin{frame}[allowframebreaks]{Bibliography}
\printbibliography[heading=subbibliography]
\end{frame}
\mode<all>{\end{refsection}}
\clearpage
\backmatter
\end{document}
生成真正本地的书目。
还可以限制refsection
仅适用于特定模式(可用模式有beamer
、handout
以及slide
更特殊的模式trans
和second
;该模式all
始终适用presentation
于除 之外的所有模式article
)
\mode<beamer>{...}
或者
\mode<beamer|handout>{...}
或类似结构
答案2
删除ignorenonframetext
以仅获取来自当前参考部分的引用:
\documentclass[t,
%ignorenonframetext,
handout,hyperref={bookmarks,breaklinks,colorlinks,unicode,allcolors=blue}]{beamer}
\includeonlylecture{L1}
\usepackage{biblatex-chicago}
\addbibresource{biblatex-examples.bib}
\begin{document}
\lecture[Lecture 1]{Syllabus and course introduction}{L1}
\begin{refsection}
\begin{frame}{Title}{Subtitle}
This is just filler text \parencite{massa}.
\printbibliography[heading=subbibliography]
\end{frame}
\end{refsection}
\lecture[Lecture 2]{First real lecture}{L2}
\begin{refsection}
\begin{frame}{Title}{Subtitle}
This is just filler text \parencite{murray}.
\printbibliography[heading=subbibliography]
\end{frame}
\end{refsection}
\end{document}
答案3
为了确保原始问题的完整解决方案完全清晰,我在下面发布了以下综合解决方案。我力求清晰和详细,但如果我做得过火了,请随时修改!
% Goal:
% 1) beamer presentation unencumbered with references or bibliography
% 2) handout with references, bibliography, and notes only for current 'lecture'
% 3) article with full references and bibliography
% HANDOUT/BEAMER header follows. Use alternate header for article.
\documentclass[t,
handout, % comment out for beamer presentation
hyperref={xetex,bookmarks,breaklinks,colorlinks,unicode,allcolors=blue}]{beamer}
\setbeameroption{show notes} % comment out for beamer presentation
% Sample ARTICLE header follows
%\documentclass{memoir}
%\title{HI999---Course title}
%\author{Author}
%\usepackage{beamerarticle}
\usetheme{Warsaw}
\usefonttheme{professionalfonts}
\setbeamertemplate{footline}[page number]{}
\includeonlylecture{L1}
\usepackage{biblatex-chicago}
\addbibresource{biblatex-examples.bib}
% Main code common to presentation, handout, and article
\mode<all>{
\institute{Department of History\\Miskatonic University}
\title{Course title}
\author{Author}
}
\begin{document}
% Here and below article-only code specifically identified
\mode<article>{
\begin{titlingpage}
\maketitle
\begin{abstract}
\noindent This course will bla-bla-bla.
\end{abstract}
\end{titlingpage}
\frontmatter
\tableofcontents
\mainmatter
}
% SAMPLE LECTURE (in the 'beamer' sense, captured or not by \includeonlylecture)
\lecture[Lecture 1]{Syllabus and course introduction}{L1}
\mode<article>{%
\chapter{Chapter heading}
}
\mode<handout>{\begin{refsection}}% applies ONLY to handout
\mode<presentation>{% applies to beamer and handout, not article
\begin{frame}{HI999---Course title}
\date{6 Jan 2020}
\title{Syllabus and course introduction}
\maketitle
\end{frame}
}
\mode<article>{%
% Whatever may be needed between frames
}
\begin{frame}{Title}{Subtitle}% all modes
This is just filler text \mode<article|handout>{\parencite{massa}}.
\note{Note page.}
\end{frame}
\mode<handout>{% only in handout
% Prints an empty frame if no references but at least make clear
% that there are no references, as opposed to leaving the impression
% that bibliography is missing
\begin{frame}[allowframebreaks]{Bibliography}
\printbibliography[heading=subbibliography]
\end{frame}
\end{refsection}
}
\clearpage
% REPEAT 'LECTURES' AS REQUIRED
\mode<article>{%
\backmatter
\chapter{Bibliography} % full bibliography
\printbibliography[heading=none]
}
\end{document}
答案4
以下解决方案不太明确,但更加整洁,遵循从@moewe 的代码中得出的见解。
它依赖于这样的认识\includeonlylecture
:ignorenonframetext
与不是意思是“无情地跳过”,但“除非被模式命令覆盖,否则跳过”。在其他方面,它也“更简约”。
% Goal:
% 1) beamer presentation unencumbered with references or bibliography
% 2) handout with references, bibliography, and notes only for current 'lecture'
% 3) article with full references and bibliography
% HANDOUT/BEAMER header follows. Use alternate header for article.
\documentclass[t,ignorenonframetext,
handout, % comment out for beamer presentation
]{beamer}
\setbeameroption{show notes} % comment out for beamer presentation
% Sample ARTICLE header follows
%\documentclass{memoir}
%\usepackage{beamerarticle}
\includeonlylecture{L1}
\usepackage{biblatex-chicago}
\addbibresource{biblatex-examples.bib}
\mode<all>{
\institute{Department of History\\Miskatonic University}
\title{Course title}
\author{Author}
}
\begin{document}
\begin{titlingpage}
\maketitle
\begin{abstract}
\noindent This course will bla-bla-bla.
\end{abstract}
\end{titlingpage}
\frontmatter
\tableofcontents
\mainmatter
% SAMPLE LECTURE (in the 'beamer' sense, captured or not by \includeonlylecture)
\lecture[Lecture 1]{Syllabus and course introduction}{L1}
\chapter{Chapter heading}
\mode<handout>{\begin{refsection}}% applies ONLY to handout
\mode<presentation>{% applies to beamer and handout, not article
\begin{frame}{HI999---Course title}
\date{6 Jan 2020}
\title{Syllabus and course introduction}
\maketitle
\end{frame}
}
% Whatever may be needed between frames for article mode goes here
\begin{frame}{Title}{Subtitle}% all modes
This is just filler text \mode<article|handout>{\parencite{massa}}.
\note{Note page.}
\end{frame}
\mode<handout>{% only in handout
% Prints an empty frame if no references but at least make clear
% that there are no references, as opposed to leaving the impression
% that bibliography is missing
\begin{frame}[allowframebreaks]{Bibliography}
\printbibliography[heading=subbibliography]
\end{frame}
}
\mode<handout>{\end{refsection}}
\clearpage
% REPEAT 'LECTURES' AS REQUIRED
\backmatter
\chapter{Bibliography} % full bibliography, article only
\printbibliography[heading=none]
\end{document}