In my document (KOMA script article) I use the listings package for code listings and the caption package for additional control over captions.

My problem is that some listings flow over multiple pages. When this occurs I would like to have something like "Listing n, continued", or something to that effect at the start of each additional page --- so a contination caption.

I know the captions package supports breaking up captions and doing the "continued" stuff, but am unsure how to get the listings package on board. Any ideas?

marked as duplicate by jubobs, Jesse, Peter Jansson, Martin Schröder, Guido Feb 27 '14 at 12:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


If you don't find a ready-to-use feature here's an approach using the header: right before the long listing you could use \markboth to add the listings name to the header entry. No matter how long the (perhaps external) file is, the header would show the name, perhaps in addition to the section name.

If you like this approach I could create an example.

  • This sounds great. A brief example would be appreciated. Do you need to manually 'unmarkboth' after the listing? – Aaron J Lang May 11 '12 at 20:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.