TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What I'm doing: Typsetting source code using pygments.

What is happening: the code typsets fine, but because pygments puts the code into a Verbatim environment, some of the lines are far too long.

What I want to have happen: I want the lines to break at the edge of the column without adding extra lines in the line numbering.

What I've tried: reading the fancyvrb documentation, using BVerbatim and LVerbatim.

Is there a way to either automatically break the lines or insert line breaks without adding line numbers?

share|improve this question
Another option would be to use shorter lines in the first place. – SamB Dec 2 '10 at 20:57
I could do that. But then I'd have to rewrite all of my code to fit into a specific tech document style. That sounds like a lot more work than just using a different package. – philosodad Dec 3 '10 at 0:01
Well, whether it's a good choice or not depends on what the goals of the document and code are, obviously, as well as on how much work it would be to do... like, if you're documenting some messy real-world application, that's different from if writing a "functional pearls" paper. – SamB Dec 3 '10 at 0:20
That's true. I've typeset code using pygments in the past, and had great luck with it. In this specific case, I needed line wrap, which is why I asked about line wrap. Listings is working beautifully. – philosodad Dec 3 '10 at 1:05
up vote 3 down vote accepted

The answer to this question--for me--turned out to be: use the listings package instead, it typsets Ruby code and provides line wrap.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.