8

If i try to get an article from my beamer slide using article mode and amsart style, my compiler (pdfLaTeX, LaTeX) gets stuck in an infinite loop:

\documentclass{amsart}
\usepackage{beamerarticle}
\title{Test}
\author{Test}

\begin{document}

\begin{frame}
\frametitle{Test}
Test frame
\end{frame}

\end{document}

Replacing amsart by article in \documentclass{article} makes everything work well.

If I remove \title AND \author keeping amsart it also works... so

  • is it a bug (from beamer)?
  • is there a way to use beamer AND amsart AND keep the titlepage info?
2

2 Answers 2

3

Prepare a file named beameramsart.sty with the following contents:

\ProvidesPackage{beameramsart.sty}
\RequirePackage{etoolbox}

\newcommand{\baa@keepamsart}[1]{%
  \@for\next:=#1\do{%
    \csletcs{amsart\next}{\next}%
    \csletcs{amsart@\next}{\expandafter\string\csname\next\endcsname}%
    \expandafter\appto\expandafter\amsartnames\expandafter{\next,}%
  }%
}
\newcommand{\baa@restoreamsart}{%
  \@for\next:=\amsartnames\do{%
    \csletcs{\next}{amsart\next}%
    \csletcs{\expandafter\string\csname\next\endcsname}{amsart@\next}%
    \csundef{amsart\next}\csundef{amsart@\next}%
  }%
}

\baa@keepamsart{title,author,date}
\RequirePackage{beamerarticle}
\baa@restoreamsart

\@onlypreamble\baa@keepamsart
\@onlypreamble\baa@restoreamsart

\endinput

Save this file alongside your LaTeX document or in a place where TeX can find it; on a TeX Live distribution it can be the directory

~/texmf/tex/latex/beameramsart

where ~ stands for your home; on Mac OS X with MacTeX it would be

~/Library/texmf/tex/latex/beameramsart

Now your document can be

\documentclass{amsart}
\usepackage{beameramsart}

\begin{document}

\title{Test}
\author{Test}

\maketitle

\begin{frame}
\frametitle{Test}
Test frame
\end{frame}

\end{document}

The problematic commands are saved before loading beamerarticle and restored afterwards; the way of saving them is a bit convoluted because of the reasons given by Joseph.

1
  • It works fine, so i can continue using \input{main.tex} in separate master files for article / handout / slides without having to repeat title & author in all master files, keeping DRY is great :-)
    – jmbarbier
    Mar 17, 2013 at 22:53
7

This is what I would describe as an 'issue' in beamer, in that it's more properly a bug but one that it's not really safe to fix. What is happening is that \title is normally a very simple command:

\documentclass{article}
\show\title

> \title=macro:
#1->\gdef \@title {#1}.

but amsart redefines it as a 'robust' command. That is normally fine, but beamer makes a copy of \title and installs a new definition. When Till Tantau wrote beamer, he did not anticipate needed to handle robust commands, so the way that the copy is made then leads to a circular definition.

The reason I class this as an 'issue' rather than a bug is that at this stage (beamer has been in use for many years) it's not really possible to alter the code in this area without almost certainly badly breaking some documents. Thus all that can be done is to live with the problem. As pointed out in comments, setting the \title and \author before beamer gets involved is probably the best way out of this.

\documentclass{amsart}
\title{AN Other}
\author{Test}
\usepackage{beamerarticle}

\begin{document}
\maketitle
\begin{frame}
\frametitle{Test}
Test frame
\end{frame}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .