If you want it very short, try the plain-TeX \obeylines
. It should be used in a group, however. Also, TeX starts a new paragraph after each line in obeylines-mode, which might result in indentation. So you probably want to change indentation (third example below).
Try it like this (with default for comparison):
\documentclass{article}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
{\obeylines %
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
}
{\parindent=0pt \obeylines %
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
}
\end{document}
Note that it is often undesirable to mix plain-TeX commands as \obeylines
with
LaTeX. However, occasionally, such solution might fit. Also, escaping is not done for you with this solution.
For more sophisticated inclusion of verbatim text, use the verbatim
environment. Note that it changes the default font to typewriter-style monospaced. The fancyvrb
package contains even more sophisticated facilities for verbatim text; it also changes the font in its environment by default.
The listing
package is intended to typeset program code listing and syntax-highlighting. It can also be used to simply include verbatim text in your document.
verbtain
. If the text is actually some other programming language that you are trying to show then you should also consider thelistings
package.