I use inline lstlisting-blocks with caption.
I have several listings that are running over more than one page or starting at the end of a page.
Now I want to place a hint for the readers, that the listing hasn't ended and goes further on the next page. This hint should be something like "further listing on next/the next but one page".
I have searched in the section 4 of the listings package manual and haven't found such parameter yet. Is there a possibility to show such a hint?
Best Answer
You could use the help of
mdframed
and expecially its optionssingleextra
,firstextra
,secondextra
andmiddleextra
. The different options allow you to have different styles for a frame that's on a single page and a frame that is broken over two or more pages.When
mdframed
is used withframemethod=tikz
you have access to the corners of a frame. The node on the lower left corner is called(O)
and the one on the upper right(P)
. The lower right one can thus be accessed by(O -| P)
and the upper left one by(P -| O)
.This can be used in combination with
\lstnewenvironment
to get a customized listings environment that does what one wants.Below I define a
mdframed
style that adds some continuing information if a frame is split and a newlistings
environment that uses this frame style. Here is how it looks:And here is the code: