Thursday, October 7, 2010

Latex \newcommand for \end{verbatim} et.al not working

Programmer Question

I'm trying to make Latex usable, by introducing some timesavers, but I'm having trouble with defining new commands that terminate environments, completely at random.



This works:

\newcommand{\bcv}{\ensuremath{\begin{smallmatrix}}}
\newcommand{\ecv}{\ensuremath{\end{smallmatrix}}}

\newcommand{\be}{\begin{enumerate}}

\newcommand{\ee}{\end{enumerate}}



This does not work:

\newcommand{\bal}{\begin{align*}}

\newcommand{\eal}{\end{align*}}


\newcommand{\verbass}[1]{\begin{verbatim} #1 \end {verbatim}}



Specifically, I think the \end value is just ignored?



When I try to use \verbass{Halp} I get an error: !File ended while scanning use of \@xverbatim.



Obviously I can use \begin{foo} ... \end{foo} at all locations as needed, but really, this should work!



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails