0

I like to keep all my university lecture and tutorial slides for a given course in one file because it is so much less work than having a separate file for each, particularly since I use the article mode with memoir to produce a course book for myself and my TAs.

I have discovered, however, that having a second (or more) \lecture commands interferes with the production of bibliography at the end.

I have tried (unsuccessfully) various schemes suggested by others (e.g., How do I add a separate bibtex bibliography in beamer to each lecture?) but in any case have cobbled together an MWE based on an actual biblatex example file to illustrate the issue.

Somehow, the refsections don't seem to take hold.

For the handout, I want bibliography for only the current lecture. With my memoir template, I want everything: all slides and the entire bibliography. Currently, the slides are properly filtered, but the bibliography is entire, whether slides are included or not.

I can do this using \include files and \includeonly but as noted above would prefer not to split things up.

MWE:

% 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}
5
  • I removed the excerpts from bbiblatex-examples.bib to avoid confusion. Every biblatex installation comes with this file, so people who can run the example without encountering a missing biblatex.sty error should have no issue with the .bib file. – moewe Jan 2 '20 at 13:12
  • Please consider accepting one of the provided answers. – Dr. Manuel Kuehner Jan 4 '20 at 15:06
  • @Dr.ManuelKuehner I did, yesterday! See the bottom of this page. Did I not do it correctly? – K.G. Feuerherm Jan 4 '20 at 18:31
  • I didn't see that: Did you accept your own answer? I would recommend to accept one of the other answers and include your code as an update into your question. – Dr. Manuel Kuehner Jan 4 '20 at 18:39
  • I did. The first other answer did not really address the entire concern, otherwise I would have accepted it; and the other is there mainly to provide additional information about another aspect of the issue. I accepted one of my own following consultation with another person and upvoted the first answer as it set me on the track. – K.G. Feuerherm Jan 4 '20 at 19:45
2

As kaba's answer already hints at, \begin{refsection} and \end{refsection} are ignored due to the ignorenonframetext option (since they appear outside of frames).

By wrapping \begin{refsection} and \end{refsection} into

\mode<all>{...}

you can make sure they are always taken into account by 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}

produces truly local bibliographies.

It is also possible to restrict the refsection to apply only to particular modes (the available modes are beamer, handout, slide and the more special modes trans and second; the mode all applies always, presentation to all modes except article)

\mode<beamer>{...}

or

\mode<beamer|handout>{...}

or similar constructions

9
  • Yes, I got that. Since then, I have, as I had suggested, tinkered with mode commands and have got the result I need; ive just not had a moment to post the complete details. @kabas comment did put me on the right track but only addressed half the issue so I’m not sure about the appropriate way to close off this question. I posted the bib information for the sake of saving prospective helpers the effort of having to dig it up for themselves; I was aware that everyone would have it, but I thought the protocol was to make MWEs as complete as possible. – K.G. Feuerherm Jan 3 '20 at 5:15
  • @K.G.Feuerherm If you want (for example because you feel that none of the answers given already addresses your question properly or completely), you can write an answer yourself and accept that. But it would be good if in the end you would accept one of the answers (or upvote at least one of them), so that the question is marked as resolved by the system. – moewe Jan 3 '20 at 6:12
  • @K.G.Feuerherm Yes, MWEs should be as complete as possible, but they should also be minimal. Since everyone with biblatex will have biblatex-examples.bib installed (and it will be installed in such a way that the file is found automatically, so there is nothing anyone would have to do to retrieve it in order to run the MWE) and the exact details of the entries don't matter to the question at all, it just adds noise to include the file in the question (and it confused me for a second). – moewe Jan 3 '20 at 6:17
  • Really? Ok, my mistake. As it was in the doc part of the tree, I didn’t expect it would be found. I will post a minimal complete resolution shortly and upvote the tip which got me on the road. – K.G. Feuerherm Jan 3 '20 at 15:18
  • @K.G.Feuerherm It is not only in the doc part (where it is indeed not found, I believe), but also in bibtex/bib/biblatex, where kpsewhich (and thus both Biber and BibTeX) can find it. – moewe Jan 3 '20 at 16:04
1

Remove ignorenonframetext to get only cites from current refsection:

\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}
1
  • Hmm, aha, yes, I see why this works. Ok, but I need all the text in between. The whole point is to use the same file for the article run and then presentation/handout runs. I guess I could do it with \mode<article> wraps around the non-presentation text, and \mode<presentation>s around the partial bibliographies as well. I'll tinker. – K.G. Feuerherm Jan 1 '20 at 17:54
0

To ensure that the full solution to the original problem is entirely clear, I post the following comprehensive solution below. I have aimed for clarity and detail but if I've gone overboard, feel free to edit!

% 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}
0

The following solution is less explicit but much tidier, following insights derived from @moewe's code.

It relies on the realization that as with \includeonlylecture, ignorenonframetext does not mean 'skip ruthlessly' but 'skip except when overridden by mode command'. In other respects it is also 'more minimal'.

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

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.