Whenever I have a page break splitting my lstlisting on different pages, I would like to have a symbol or generally spoken some command inserted automatically. I can accomplish that manually by using the lstlisting's escape character:
\begin{lstlisting}[language=cs]
class MyClass
{
// assume this is on one page
´
\begin{flushright}
$\blacktriangledown$
\end{flushright}
´
// assume this is on the other page
}
\end{lstlisting}
However, when I add enough text before the listing, the symbol won't be placed at the right spot anymore. It will get moved to the next page where it doesn't make sense anymore. To tackle that I need some dynamic placement of some user-defined latex to be inserted right at the spot where a page break splits my lstlisting apart.
Update: There is a formfeed Parameter that can be set within lstset. It defaults to \bigbreak and even though inserting \bigbreak in escaped mode within the listing results in the same visual appearance of a split of the listing like it happens at page breaks, changing formfeed doesn't make a change in the output, really unfortunately.
Is there a solution to it?
