13

I'd like to have an environment that encloses all its content into the typewriter font as \texttt{} does. However, I do not want to use \texttt{} but an own environment, e.g. \begin{allintypewriter} because my text contains multiple paragraphs.

So instead of

\texttt{
My multiparagraph text
}

I'd like to write

\begin{allintypewriter}
My multiparagraph text
\end{allintypewriter}

Sorry, it's a newbe question, but how do I define a \newenvironment for this? (I do not want to use something like \verbatim because the text to be set as typewriter should contain other latex commands; only the font should be changed to typewriter for this environment)

0

1 Answer 1

20

The more general version of you question is dealt with here:

How do I use a particular font for a small section of text in my document?

But since you only need to change the font family and not the font itself, your particular instance of it is much simpler:

\newenvironment{allintypewriter}{\ttfamily}{\par}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .