Document Classesnew comment environment

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
bobbylou
Posts: 18
Joined: Tue Apr 21, 2009 6:54 pm

new comment environment

Post by bobbylou »

Hi,

I am writing a beamer presentation and I'm trying to create two sets of presentations, one of which omits entirely some of the slides of the other. That is, for certain frames I would like to define a new environment that, by changing the \newenvironment command at the top, the frame will either be included or not. I figured I could achieve this by defining a new environment to be equivalent to the "comment" environment. This is what I've tried and it's giving me an error:

Code: Select all

\documentclass{beamer}
\usepackage{verbatim}

\newenvironment{omitframe}{\begin{comment}}{\end{comment}}

\begin{document}

\begin{omitframe}
Stuff.
\end{omitframe}

\end{document}
The thing is, if I define the \newenvironment command like this:

Code: Select all

\newenvironment{omitframe}{\begin{frame}}{\end{frame}}
it works just fine.

Thanks very much.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
johnjamessmith0
Posts: 37
Joined: Sun Mar 29, 2009 1:41 am

new comment environment

Post by johnjamessmith0 »

I don't know what's causing the error. It might be that the everything between the \begin{comment} and \end{comment} (that is, the "}{") is treated as a comment. I propose the following solution, using a the package environ, which seems pretty nice:

Code: Select all

\documentclass{beamer}
\usepackage{verbatim}
\usepackage{environ}

\NewEnviron{omitframe}{}
%\NewEnviron{omitframe}{\begin{frame}\BODY\end{frame}}

\begin{document}

\begin{omitframe}
Stuff.
\end{omitframe}

\end{document}
Hope this helps.
Post Reply