Another note. \collect@body was designed to fail when the environment contains multiple \par(agraph)s. Luckily, there's a replacement called \Collect@Body in the environ package:
http://www.ctan.org/tex-archive/macros/ ... b/environ/
Search found 2 matches
- Tue Nov 17, 2009 4:39 am
- Forum: General
- Topic: Define own environment with the option to drop its content
- Replies: 3
- Views: 3453
- Tue Nov 17, 2009 2:31 am
- Forum: General
- Topic: Define own environment with the option to drop its content
- Replies: 3
- Views: 3453
Define own environment with the option to drop its content
I'm a n00b, so I didn't understand what the answer meant. After messing around for a while, I devised the following MWE.
\documentclass{report}
\usepackage{amsmath}
\makeatletter
\newcommand{\mycommand}[1]{aa#1zz}
\newenvironment{myenv}{begin \collect@body\mycommand }{ end}
\makeatother
\begin ...
\documentclass{report}
\usepackage{amsmath}
\makeatletter
\newcommand{\mycommand}[1]{aa#1zz}
\newenvironment{myenv}{begin \collect@body\mycommand }{ end}
\makeatother
\begin ...