tags:

views:

934

answers:

3
+2  A: 

All I can do is point you at the listings docs and suggest that there is a section therein named "Margins and line shape". Are these options among those that you have tried?

In particular I see options with names like linewidth, breaklines, and breakautoindent which cetainly suggests that listings supports your needs.

dmckee
I tried every combination of them I could think of, and it doesn't work.
Adam
Hmmm...I suspect there is little we can do for you without some code to look at.
dmckee
+1  A: 

Not a great answer, but one idea is to word wrap the source code before including it. If you're on linux, the command fold can be used for this. Clearly this works best if the text is in a fixed width font, which i would recommend in any case for code listings.

second
+1  A: 

I just had this problem...

breaklines worked for me, though you do need to set it to true - the default is false:

\lstinputlisting[style=Python,
    caption=My Class,
    label={mine.py},
    breaklines=true,
  ]{../python/mine.py}

is pretty much what I used

PeterJCLaw