12

I want to use the comment package in my presentation. I read that it does not always work in some very complicated contexts, but here it fails even in a very simple example:

\documentclass{beamer}
\usepackage{comment}
\begin{document}
\begin{frame}
random text

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

\end{frame} 
\end{document}

I can't find a solution for this problem in this site. Is there an incompatibility or am I missing something?

  • That was it. Anyway, where is it documented? I searched both the docs and found nothing... – Jason T. Jan 4 '14 at 12:30
  • 1
    @dcmst you should convert your comment to an answer then – masu Jan 4 '14 at 14:22
13

The comment environment works by interpreting the content of the environment as verbatim text which is then discarded.

For this reason in beamer it needs to be loaded inside a fragile frame, like other verbatim text:

\documentclass{beamer}
\usepackage{comment}
\begin{document}
\begin{frame}[fragile]     % fragile option
random text

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

\end{frame} 
\end{document}

This is not documented directly but is implied by the inner workings of the comment package, explained in the documentation.

| improve this answer | |

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.