Possible Duplicate:
How to prevent lstlisting from splitting code between pages?
I have a rather long listing on a page that has 3-4 lines on the following page. Just before the listing is one 7-line paragraph.
I'd like to have the listing start 2cm earlier (move it upwards) so that the whole listing fits on the page. The paragraph must then lose its last 3-4 lines to the next page -- but: without having the paragraph justification being interrupted.
I guess I have to introduce a sort of "minipage" around the listing or something and lat that be moved around independently from the running text -- not unlike an image. But how?
listingscan be used as an float environment. So you have no page breaks. – Marco Daniel Dec 08 '11 at 18:19