Tim Arnold
2005-10-12 15:51:03 UTC
This minimal example shows how newenvironment behaves with and without an
optional argument in its definition. I've read the FAQ and googled, but I
still don't understand this.
The first example displays 'BEGIN_these are three ... etc.' (_=space)
The second displays 'BEGINthese are three ... etc.'
==========================
\documentclass{book}
\begin{document}
\newenvironment{code}{BEGIN}{END}
hi
\begin{code}
these are three
lines that are
indented \textit{three} spaces.
\end{code}
there
\renewenvironment{code}[1][]{BEGIN}{END}
\begin{code}
these are three
lines that are
indented \textit{three} spaces.
\end{code}
bye
\end{document}
=====================
fyi, what I had originally desired was the following environment, using
memoir.cls:
--------------------------------------
\newenvironment{code}[1][small]{%
\setverbatimfont{\csname#1\endcsname\ttfamily\bfseries}%
\verbatim}
{\endverbatim}
-------------------------------------
in which case beginning spaces in the 'code' first line are ignored.
thanks,
--Tim Arnold
optional argument in its definition. I've read the FAQ and googled, but I
still don't understand this.
The first example displays 'BEGIN_these are three ... etc.' (_=space)
The second displays 'BEGINthese are three ... etc.'
==========================
\documentclass{book}
\begin{document}
\newenvironment{code}{BEGIN}{END}
hi
\begin{code}
these are three
lines that are
indented \textit{three} spaces.
\end{code}
there
\renewenvironment{code}[1][]{BEGIN}{END}
\begin{code}
these are three
lines that are
indented \textit{three} spaces.
\end{code}
bye
\end{document}
=====================
fyi, what I had originally desired was the following environment, using
memoir.cls:
--------------------------------------
\newenvironment{code}[1][small]{%
\setverbatimfont{\csname#1\endcsname\ttfamily\bfseries}%
\verbatim}
{\endverbatim}
-------------------------------------
in which case beginning spaces in the 'code' first line are ignored.
thanks,
--Tim Arnold