Merge pull request #67 from wollanup/master

Add option to avoid page break in listings
This commit is contained in:
Pascal Wagler 2018-11-30 19:42:14 +01:00 committed by GitHub
commit bec1b56658
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -74,6 +74,9 @@ This template defines some new variables to control the appearance of the title
- `listings-disable-line-numbers` (defaults to `false`)
disables line numbers for all listings
- `listings-no-page-break` (defaults to `false`)
avoid page break inside listings
- `disable-header-and-footer` (default to `false`)
disables the header and footer completely on all pages

View File

@ -262,6 +262,11 @@ $if(listings)$
\usepackage{listings}
\newcommand{\passthrough}[1]{#1}
$endif$
$if(listings-no-page-break)$
\usepackage{etoolbox}
\BeforeBeginEnvironment{lstlisting}{\par\noindent\begin{minipage}{\linewidth}}
\AfterEndEnvironment{lstlisting}{\end{minipage}\par\addvspace{\topskip}}
$endif$
$if(lhs)$
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
$endif$