Latex \newcommand for \end{verbatim} et.al not working -
i'm trying make latex usable, introducing timesavers, i'm having trouble defining new commands terminate environments, @ random.
this works:
\newcommand{\bcv}{\ensuremath{\begin{smallmatrix}}} \newcommand{\ecv}{\ensuremath{\end{smallmatrix}}}
\newcommand{\be}{\begin{enumerate}}
\newcommand{\ee}{\end{enumerate}}
this not work:
\newcommand{\bal}{\begin{align*}}
\newcommand{\eal}{\end{align*}}
\newcommand{\verbass}[1]{\begin{verbatim} #1 \end {verbatim}}
specifically, think \end value ignored?
when try use \verbass{halp}
error: !file ended while scanning use of \@xverbatim.
obviously can use \begin{foo} ... \end{foo} @ locations needed, really, should work!
how \begin{verbatim}
works. briefly , roughly.
\begin{verbatim}
expanded\verbatim
.- then
\verbatim
sets category code of each characters 11. chars letters. - then
\verbatim
sets font, parindent , calls\@xverbatim
. \@xverbatim
catches end of verbatim using following trick:\def\@xverbatim#1\end{#1\end}
then \end{verbatim} finishes work.
how \newcommand{\verbass}[1]{\begin{verbatim} #1 \end {verbatim}}
work.
- first of
\verbass{halp}
reads argument. #1 --> halp
\verbass
expands\begin{verbatim} halp \end {verbatim}
. important: backslash of\end
has category 0 rather 11.{
,}
have categories 1 , 2 rather 11.- then
\begin{verbatim}
expands\varbatim
.\varbatim
changes categories , font. (important) category of backslash (in\end
) remains equal 0. - then
\verbatim
calls\@xverbatim
. \@xverbatim
tries catch argument using following trick:\def\@xverbatim#1\end{#1\end}
but impossible because of
\@xverbatim
tries catch\end
letters (\
,e
,n
,d
) have category 11. in fact there 4 letters other category code:\
category 0 ,e
,n
,d
category 11.\@xverbatim
trying , trying find\end
backslash (\
) has category 11 but....file ended while scanning use of \@xverbatim
Comments
Post a Comment