1

Is it possible to have a beamer environment completely discarded in a given mode?

In the following MWE, I'd like the 2nd actionenv tikzpicture environment to be centered with the items of the other column but there is some vertical space added from the first actionenv even though it's not displayed in beamer mode. I work around this problem by using wrapping the trikzpicture in a \only<article> (see the 2nd frame) but I don't see why it's needed.

Of course I could remove all the actionenv environments and just use the \only<article> macros but for some reasons (the file is created by org-mode export), I can't.

\documentclass{beamer}

\usepackage{standalone,tikz}

\begin{document}

\begin{frame}
  \begin{columns}
    \begin{column}{.45\columnwidth}
      \begin{actionenv}<article>
        \begin{tikzpicture}
          \draw [very thick, red, ->] (0,0) -- (4,4);
        \end{tikzpicture}
      \end{actionenv}
      \begin{actionenv}<presentation>
        \begin{tikzpicture}
          \draw [very thick, red, ->] (0,0) -- (4,4);
        \end{tikzpicture}
      \end{actionenv}
    \end{column}
    \begin{column}{.45\columnwidth}
      \begin{itemize}
      \item 1st item
      \item 2nd item
      \item 3rd item
      \end{itemize}
    \end{column}

  \end{columns}
\end{frame}


\begin{frame}
  \begin{columns}
    \begin{column}{.45\columnwidth}
      \begin{actionenv}<article>
        \only<article>{
          \begin{tikzpicture}
            \draw [very thick, red, ->] (0,0) -- (4,4);
          \end{tikzpicture}
        }
      \end{actionenv}
      \begin{actionenv}<presentation>
        \only<presentation>{
          \begin{tikzpicture}
            \draw [very thick, red, ->] (0,0) -- (4,4);
          \end{tikzpicture}
      }
      \end{actionenv}
    \end{column}
    \begin{column}{.45\columnwidth}
      \begin{itemize}
      \item 1st item
      \item 2nd item
      \item 3rd item
      \end{itemize}
    \end{column}

  \end{columns}
\end{frame}

\end{document}

enter image description here

1

That seems to be a good case for the onlyenv environment:

\documentclass{beamer}

\usepackage{standalone,tikz}

\begin{document}

\begin{frame}
  \begin{columns}
    \begin{column}{.45\columnwidth}
      \begin{onlyenv}<article>
        \begin{tikzpicture}
          \draw [very thick, red, ->] (0,0) -- (4,4);
        \end{tikzpicture}
      \end{onlyenv}
      \begin{onlyenv}<presentation>
        \begin{tikzpicture}
          \draw [very thick, red, ->] (0,0) -- (4,4);
        \end{tikzpicture}
      \end{onlyenv}
    \end{column}
    \begin{column}{.45\columnwidth}
      \begin{itemize}
      \item 1st item
      \item 2nd item
      \item 3rd item
      \end{itemize}
    \end{column}

  \end{columns}
\end{frame}

\end{document}

enter image description here

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.