Tag Info

New answers tagged

0

You could use the minipage environment, which ensures that everything contained in itself is held together, and, if there is no more room for it, in its entirety, to fit, then it moves itself to the next page where it should have ample room to display (it's only six lines, so it shouldn't have to span multiple pages). \documentclass[a4paper]{article} ...


1

I had a similar problem where a the caption and maybe one line of code would appear at the end of one page and the rest of the code on the next one. What helped me was the needspace package. Its not quite perfect, as I have to set the command in front of every \lstlisting that is broken at the wrong place but its all right for a quick n dirty solution. % ...



Top 50 recent answers are included