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

I need listing package (\usepackage{listing}) to break at punctuation

           ^             ^

at either these two locations

share|improve this question
up vote 5 down vote accepted

This breaks at ::, but puts it :: in the new line.


This leaves a hyphenated :: in the old line, but the spacing is terrible.


This monster fixes the spacing:


Btw, you can also break in the middle of :: ;-)

share|improve this answer
For punctuation in general does that mean I will have to define them one by one? – aiao Feb 11 '13 at 12:45
At least I don't know a better way. – Sašo Živanović Feb 11 '13 at 12:53

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.