Long lines in LaTeX

lmsasu picture lmsasu · Feb 4, 2009 · Viewed 10.6k times · Source

I have some code I write inside the verbatim environment. Sometimes, the lines are too long and the generated pdf looks ugly - the text row passes over the right margin. What can I do to automatically break these long lines? Is there anything better than the verbatim env?

Thanks, Lucian

Answer

Diego Sevilla picture Diego Sevilla · Feb 4, 2009

Of course, you have the wonderful "listings" package for that. It supports (if you want) even pretty printing of a lot of source code languages, as well as a "smart breaking" of long lines depending on the language being displayed.