Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Long lines in LaTeX

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

like image 859
lmsasu Avatar asked Nov 29 '22 00:11

lmsasu


2 Answers

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.

like image 134
Diego Sevilla Avatar answered Dec 06 '22 21:12

Diego Sevilla


Can you just use a fixed-width font, e.g. \texttt{}? If you require something more sophisticated, try the moreverb, listings, or algorithmicx packages.

like image 33
Zach Scrivena Avatar answered Dec 06 '22 21:12

Zach Scrivena