I am using Pandoc to generate Tex from Markdown. It automatically generates listings when it comes across the appropriate Markdown (code indented four spaces). It then uses the listings package to instantiate those listings in Tex. The resulting code is:
\begin{lstlisting}[language=bash]
# java -version
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (rhel-2.3.3.el6_3.1-i386)
OpenJDK Client VM (build 23.2-b09, mixed mode)
\end{lstlisting}
Sometimes these code listings extend across a page break and I'd prefer if they were bumped to the next page if this happens. I've looked around and seen a few suggestions about adding a minipage to the listing but since my Tex is being auto-generated via Pandoc it's not clear how I can do that without manually editing the resulting Tex document to add the minipages before and after the lstlistings.
So I am looking for:
- A way to bump the listings to the next page automatically, or
- A way to tell LaTex to redefine the lstlisting to have minipages before and after it.
EDIT: I should have added for those unfamiliar with Pandoc that the template it uses to generate Tex is here.
Thanks!
\usepackage{listings}, use\usepackage{listings,float}\lstset{float=H}. Again, since I'm unfamiliar with Pandoc, you'll have to try it. – Werner Dec 25 '12 at 5:40listingspackage when you pass the--listingsoption to Pandoc. I've made your change and given that a try but the listings continue to extend over the page break I am afraid. Thanks for your help though. – jamtur01 Dec 25 '12 at 5:59floatoption seem to be specific to an environment, and cannot be set globally. Do you have access to the language settings it uses (language=bash)? – Werner Dec 25 '12 at 16:04