Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there any way to prevent the listings package from leaving unsightly gaps in the frame when using breaklines=true. I'm just \lstinputlisting some code, placing it in a shadowbox frame and letting listings wrap the longer lines. This sometimes causes breaks in the frame (where a line has been split). I've seen other tex.stackexchange users encounter this problem when embedding maths (or other commands that use more than the expected line height); I'm not attempting anything as exotic. Is this a bug in Listings?

share|improve this question
    
I am sure you will not the last person who will encounter such an issue. It would be helpful if you composed a small compilable MWE that illustrated the problem so that it might help others in the future. Since you have actually discovered the solution, this should be fairly easy. This might also explain why no answer appeared either, as it is difficult to fix a problem without first being able to reproduce it. –  Peter Grill Nov 20 '12 at 20:01
add comment

1 Answer

up vote 0 down vote accepted

Who knows if anyone will ever find this useful, but here goes. I discovered the answer to my problem of the frame becoming broken. It was caused by having spaces in front of keywords in my custom language definition. The gaps always corresponded with where a line had been broken and a keyword was the first item on the remainder of the wrapped line. By ensuring that there were no spaces and only commas between my keywords I rectified the issue.

share|improve this answer
add comment

Your Answer

 
discard

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.