Always* insert a fixed slide after the title slide

I'm implementing my institution's PP templates -- like so many others. At our organisation we're often presenting classified stuff and we're supposed to include a slide with information about classification and remind people to take their electronics out of the room.

Ideally, the user shouldn't have to remember to include this slide by herself: If beamer is told that that the presentation contains classified information, then it should automatically insert this slide after the title page. For now, let's just assume there exists a boolean classified.

As a workaround, I could do it as a transition on the title page template. However, that would look very strange when printing.

It feels like this question is related to Theme with a different footline for the titlepage (in principle, insert some stuff before and after should be equivalent?), but I haven't been able to proceed.

There is no MWE, as I don't even know where to begin. As such, I'm happy to just get pointers in the right direction, and I'll make sure to post a working result at the end.

• Maybe some like \deb\classified{\begin{frame}\frametitle{Classified} Get the damn phones out of this room \end{frame}} somewhere in the in the preamble/ external preamble/custom package/custom class, and then simply use \classified classified information or do nothing for not classified material ?
– Fran
Jul 16, 2019 at 8:51
• @Fran, just to check if I understand you correctly: The user should add \classified themselves to get that slide? It is of course a safe fall-back option, but I wanted to explore the possibility of the user not having to do anything. :-) Jul 16, 2019 at 8:54
• What do you mean with "anything"? The template must guess what the user wants? The user must write in someway that presentation is classified, right? None more simple that uncomment %\classified when needed. If you are thinking really in some more complex that press Del (a mandatory switch, or include information in \maketitle, AI to determine when is classified (haha), etc.) you will have to be more specific about your needs.
– Fran
Jul 16, 2019 at 10:00
• @Fran I realise I've been somewhat vague. I'm setting the classification when importing the theme, \usetheme[classification=nr]{institutiontheme}. Hence, having an extra \classified is -- information theoretically -- redundant information. (It's basically a question of over-the-top style. I principle, I want the user to be able to start with a completely blank document, and use only what he knows from vanilla Beamer. I might have to abandon that.) Jul 16, 2019 at 10:07

You could put the title page and a conditional 'Classified' frame in a style file. The frames can be inserted using the AfterEndPreamble hook from the etoolbox package, which is executed at the end of the \begin{document} command.

MWE, iooci.sty:

\usepackage{etoolbox}
\newif\ifclassified
\classifiedtrue   % set boolean to true by default
\institute{Institute of Often Classified Information}   % default institute and logo
\logo{\fbox{\Huge IoOCI}}
\AfterEndPreamble{
{%
\setbeamertemplate{logo}{}            % and logo for first two slides
\begin{frame}
\maketitle
\end{frame}
\ifclassified   % show slide only if boolean is true
\begin{frame}{Classified}
This presentation is classified
\end{frame}
\fi % end if
}   % end scope of switching off navigation and logo
}


Document with extra slide:

\documentclass{beamer}
\usepackage{iooci}
\author{John Smith}
\date{\today}
\begin{document}
\begin{frame}{First real slide}
\end{frame}
\end{document}


And without:

\documentclass{beamer}
\usepackage{iooci}
\author{John Smith}
\date{\today}
\classifiedfalse
\begin{document}
\begin{frame}{First real slide}
\end{frame}
\end{document}


Result (with extra slide):

• Thanks. It's almost what I hoped for, with the only drawback being the assumption that there will be only one title slide, and that it always appears first. I guess it can be remedied turning the code in the hook handler into a new command, and then documenting that for the users. I'll leave the question open for a little longer before accepting, just in case someone knows about some pure magic. Jul 16, 2019 at 10:10

I finally opted to use a variation of @Fran's suggestion in the comments above. A justification to future people like me follows below. In the style of @Marijn's code:

iooci.sty

\usepackage{etoolbox}

\institute{Institute of Often Classified Information}   % default institute and logo
\logo{\fbox{\Huge IoOCI}}

\setbeamertemplate{classificationframe}{%
\begin{frame}
\frametitle{Classified}
This presentation is classified
\end{frame}
}


Document

\documentclass{beamer}

\usepackage{iooci}
\author{John Smith}
\date{\today}
\begin{document}

\begin{frame}
\maketitle
\end{frame}

\usebeamertemplate{classificationframe}

\begin{frame}{First real slide}
\end{frame}
\end{document}


Why not anything more fancy? I figured I had to tell the user how to do stuff nonetheless, so I opted for the most straight-forward solution.

Along the way, I explored using [allowframebreaks] (see Beamer allowframebreaks default option), but if I redefined the frame to allow me to put the classification info on the title page template, it could potentially break how the user expected new frames to work, including \frame{\titlepage} and frames with [fragile].

Fran and Marijn, thanks for taking the time to answer a vague question. It helped me explore my possibilities.

Any better solutions than the one I ended up with are obviously still welcome.