[Tex/LaTex] Beamer slides and tufte-handout

beamerdocument-classestufte

I have been experimenting with a setup for slides and handouts with one main.tex file that is \input{} into a "slides" and a "handout" file (as described in the beamer user guide 21.2.1, or this example. This setup allows the handout to be typeset using different documentclasses (i.e. report, article – which I am able to produce).

However, I have been trying to use the tufte-handout class, but the compilation comes to a halt, without giving any particular error messages.

I noticed the compilation halted on amsthm so I used the [noamsthm]{beamerarticle} class option. Then the compilation halted on beamerbasetheorems.styso I used [notheorems]{beamerarticle} in the class option, but then it once again halted on amsthm.

I then tried to give both in the class options (i.e. [notheorems,noamsthm]{beamerarticle}), but this appears to ignore the [notheorems]{beamerarticle} option resulting in the same error message as when only giving the [noamsthm]{beamerarticle} option.

So, my question is, has anyone successfully used this setup to produce beamer slides and handouts using the tufte-handout class?

Minimal examples provided as requested:

File1 (slides.tex):

\documentclass[ignorenonframetext]{beamer}  
\input{main.tex} 

File2 (handout.tex):

\documentclass{article} % This class works  
%\documentclass{tufte-handout} % Whish to use this documentclass  
\usepackage{beamerarticle}  
\input{main.tex}

File3 (main.tex):

\usetheme{Singapore}  
\title{Title here}  
\author{Some author}  
\date{}  
\begin{document}  
\maketitle  
\begin{frame}  
\titlepage  
\end{frame}  
\section{One section}  
\begin{frame}  
\frametitle{One frame} 
\end{frame}  
Text out of frame. Should print on handout only.  
\end{document}

Best Answer

The problem appears to be related to the \title command. When I compile a document using \title then it hangs, and when I compile it without then it works just fine. There's a bit of a tangled web of definitions and redefinitions going on that is a bit hard to track. One method that worked for me was to copy out the (re)definition of \title from tufte-common.def and stick it in after the call to beamerarticle. Thus my main file looks like this:

\documentclass{tufte-handout}
\usepackage{beamerarticle}

\makeatletter
\renewcommand{\title}[2][]{%
  \gdef\@title{#2}%
  \begingroup%
    % TODO store contents of \thanks command
    \renewcommand{\thanks}[1]{}% swallow \thanks contents
    \protected@xdef\thanklesstitle{#2}%
  \endgroup%
  \ifthenelse{\isempty{#1}}%
    {\renewcommand{\plaintitle}{\thanklesstitle}}% use thankless title
    {\renewcommand{\plaintitle}{#1}}% use provided plain-text title
  \@ifpackageloaded{hyperref}{\hypersetup{pdftitle={\plaintitle}}}{}% set the PDF metadata title
}
\makeatother

\input{tufteMain}

Of course, that means that the title doesn't get "beamerified", but as this is only for the article version, that doesn't matter.

I tried storing the old definition of \title before calling beamerarticle and resetting it afterwards, but that didn't work:

\documentclass{tufte-handout}
\let\tufteTitle=\title
\usepackage{beamerarticle}
\let\title=\tufteTitle

\input{tufteMain}

still hung.

In general, TeX hangs like that when it enters an infinite loop, so my guess is that somehow the definition and redefinition of \title mean that it ends up calling itself again and again. Also, when TeX enters an infinite loop then the logfile contains the last thing that it did okay, so removing stuff that has appeared in the logfile isn't an optimal strategy (you may happen on whatever it was that created the loop, but there's no guarantee).