# Out-of-slide comment environment in Beamer

Comment package does not work in beamer

explaining how, for \begin{comment} etc. \end{comment} to work, it needs to go inside a 'Fragile' frame. But what if I want an out-of-frame comment? Is there some workaround for the comment package, or another package with the same effect which is more, shall we say, forgiving regarding where it's used?

• What exactly do you mean with "out-of-frame comment"? – user36296 Jun 8 '16 at 9:39
• @samcarter: I mean having that comment environment outside of any frame, immediately within the document environment. – einpoklum - reinstate Monica Jun 8 '16 at 9:51

This is Text
\iffalse
This is Text, too, but not printed
\fi
Another text


Am I missing something or can you simply do:

\documentclass{beamer}
\usepackage{comment}

\begin{document}
\begin{frame}
random text
\end{frame}

\begin{comment}
hidden text
\end{comment}

\end{document}


(Works without errors with pdflatex of TeXlive 2015, 2016 and 2017, I have not tested other engines.)

Alternatively you could use the ignorenonframetext option of beamer:

\documentclass[ignorenonframetext]{beamer}

\begin{document}
\begin{frame}
random text
\end{frame}

hidden text

\end{document}

• Yes, you are missing something, this gets me an error message. – einpoklum - reinstate Monica Jun 8 '16 at 10:42
• @einpoklum Works for me with Texlive2015 and 2016 without errors. What does your error message say? – user36296 Jun 8 '16 at 10:46