Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.