I have a custom .sty file that has an option, "slides", for including packages and commands specific to beamer documents. Here's how it's structured:
\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{master-sty-mwe} % switch for 'slides' option \newif\ifyourpkgprefix@slidesoption\yourpkgprefix@slidesoptionfalse \DeclareOption{slides}{\yourpkgprefix@slidesoptiontrue} \DeclareOption*{\OptionNotUsed} % discard any undeclared option \ProcessOptions\relax \ifyourpkgprefix@slidesoption % Place anything here that is specific to slides \beamertemplatenavigationsymbolsempty \addtobeamertemplate{navigation symbols}{}{ % if noframenumbering is specified, don't print slide numbers. % else, do print slide numbers. \ifbeamer@noframenumbering \relax \else% \usebeamerfont{footline}% \usebeamercolor[fg]{footline}% \hspace{1em}% {\scriptsize\insertframenumber/\inserttotalframenumber} \fi% } \else % Place anything here that is specific to non-slides \fi \endinput What I want to achieve in the first if block is to print the current slide number and the total slide number on a slide, unless noframenumbering is specified with \begin{frame}[noframenumbering]. This all works in the following .tex file:
\documentclass{beamer} \usepackage[slides]{master-sty-mwe} \begin{document} \begin{frame}[noframenumbering] slide with no slide numbers \end{frame} \begin{frame} slide with slide numbers \end{frame} \end{document} But when I include the .sty file without the "slides" option, I get an Undefined control sequence for \usebeamerfont[footline].
Here is a .tex file that triggers the error:
\documentclass{article} \usepackage{master-sty-mwe} \begin{document} test \end{document} With some tweaking around, it seems to be the \ifbeamer@noframenumbering if/else statement that's causing the error (commenting it out fixes it), but I can't tell why we're in the \ifyourpkgprefix@slidesoption block in the first place.
I tried changing \ifbeamer@noframenumbering to something false like \ifnum2>3 but that doesn't retrigger the error. Changing it to \ifbeamer@containsverbatim also triggers the error. These ifs are defined in "beamerbaseframe.sty".
I would want to be able to use my .sty file with and without the "slides" option without running into this error, but at this point, I'm also very curious about what's going on.