24

This is probably a simple question, but I can't find the answer anywhere. How can I tell tex (latex specifically) not to format a piece of text? I.e. I want to keep indentation, line breaks, etc.

Stefan Kottwitz
  • 231,401
Xodarap
  • 1,005

2 Answers2

23

What you probably want is actually the "verbatim" environment. http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/PreFormatted.html

\documentclass{article}
\begin{document}
\begin{verbatim}
Preformatted
Text
Here
\end{verbatim}
\end{document}

This compiles to:

Text as rendered

12

I think the closest thing that will do what you want is the alltt package:

\documentclass{article}
\usepackage{alltt}
\begin{document}
\begin{alltt}
\rmfamily
hello \emph{emph}
  there
lipsum
\end{alltt}
\end{document}

Unfortunately alltt doesn't contain any features to globally change the font it uses, but as you can see setting it to use roman manually works fine.