# Keeping counters running with the ignorenonframetext option of beamer

I'm trying to use the same tex files for my lecture notes and my beamer. I'm using the same counter for all my environments (theorems, definitions, remarks, and so on) for better readability.

In my beamer presentation, some remarks don't appear, which means that I put them outside frame environments.

Hence, beamer ignores them (as I use the ignorenonframetext option), which in turns shifts the counters between my lecture notes and my presentation.

Is there a way to not show text outside the frame environments but keep the counters running?

Here is a MWE

\documentclass[ignorenonframetext]{beamer}
\setbeamertemplate{theorems}[numbered]
\usepackage{default}

\begin{document}

\begin{frame}
\begin{definition}
foo
\end{definition}
\end{frame}

\begin{definition}
bar
\end{definition}

\begin{frame}
\begin{definition}
baz
\end{definition}
\end{frame}

\end{document}


Second frame shows "Definition 2" whereas I would like to see "Definition 3".

Any tip ?

Thanks !

A manual workaround:

\begin{frame}
\begin{definition}
baz
\end{definition}
\end{frame}


Or if you would consider to abandon the ignorenonframetext option, a slightly different workflow:

\documentclass{beamer}
%\documentclass{article}
%\usepackage{beamerarticle}

\setbeamertemplate{theorems}[numbered]
\usepackage{default}

\begin{document}

\begin{frame}
\begin{definition}
foo
\end{definition}
\end{frame}

\begin{onlyenv}<beamer:0>
\begin{definition}
bar
\end{definition}
\end{onlyenv}

\begin{frame}
\begin{definition}
baz
\end{definition}
\end{frame}

\end{document}

• I guess as long as I need to enclose everything inside an environment, it's better to abandon the ignorenonframetext solution. And on the plus side I can even hide stuff inside frames and don't need to worry anymore about the \input problem. Thanks ! May 22, 2017 at 20:14