# undefined control sequences in beamerarticle

I'm trying to set up an environment where I can write slides and then recompile as an article. I'm using beamerarticle with a pair of stubs (one for beamer and one for beamerarticle) that look like this

\documentclass{article}
\usepackage{beamerarticle}

\input{CS301-lecture-style.tex}
\input{CS301-01-review-lecture-body.tex}


As I understand it, beamerarticle should ignore beamer-specific stuff that doesn't apply to an article, but I am getting "undefined control sequence" errors for several commands that work in beamer, such as \insertpagenumber. Strangely, \insertframenumber does not throw an error, but \inserttotalframenumber does.

These errors are concentrated primarily on my definition of the footer line for my slides:

\setbeamertemplate{footline}[text line]{%
\parbox{\linewidth}{\vspace*{-8pt}
\dbgCourseNumber\
\insertshortauthor\hfill
\insertshorttitle\hfill
}


Interestingly, this sequence throws another error (missing \begin{document}) if it appears before \begin{document} in beamerarticle, but works OK in the preamble of beamer. This is frustrating because I want to separate these style setup commands in a separate document that can be applied to all lectures.

Any help would be appreciated, specifically, how do I know what will work in beamerarticle and what will not.

• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user36296 Oct 5 '17 at 21:26

Normally beamer specific settings, which don't really make sense in an article, are only defined for all presentation modes:

\documentclass{article}
\usepackage{beamerarticle}

\mode<presentation>{
\setbeamertemplate{footline}{%
\parbox{\linewidth}{%
\vspace*{-8pt}%
%\dbgCourseNumber\
\insertshortauthor\hfill%
\insertshorttitle\hfill%
}
}
}

\begin{document}

\begin{frame}
test
\end{frame}

\end{document}


In the same way, you can use \mode<article>{...} to modify the footline in a way that is compatible with the article document class.