1

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 !

0
2

A manual workaround:

\begin{frame} 
    \only<beamer>{\addtocounter{theorem}{1}} 
    \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}
1
  • 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 !
    – Alexis
    May 22 '17 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.