[Tex/LaTex] Verbatim environment that can break long lines


I want to generate a PDF of user-submitted text using LaTeX. To handle crazy user input, I first thought about using the verbatim package, but of course it doesn't break up too long lines. Is there some package that works similar to verbatim (i.e., accept any input) but formats the text nicely?

Best Answer

The listings package provides you with a verbatim environment which can break lines:

  Long user text

If the user text is in an external file you can also use: