Skip to content

Commit 0070352

Browse files
jensmaurertkoeppe
authored andcommitted
[styles] Do not add a page break opportunity before codeblocks
1 parent 2b3e09e commit 0070352

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

source/macros.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@
578578
% surrounded by @ signs.
579579
\newcommand{\CodeBlockSetup}{%
580580
\lstset{escapechar=@, aboveskip=\parskip, belowskip=0pt,
581-
beginpenalty=200, midpenalty=500, endpenalty=-50,
581+
midpenalty=500, endpenalty=-50,
582582
emptylinepenalty=-250, semicolonpenalty=0,upquote=true}%
583583
\renewcommand{\tcode}[1]{\textup{\CodeStylex{##1}}}
584584
\renewcommand{\term}[1]{\textit{##1}}%

source/styles.tex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,17 @@
175175
\else
176176
\lst@ifdisplaystyle
177177
\lst@EveryDisplay
178-
% make penalty configurable
179-
\par\lst@beginpenalty
178+
\par\lst@beginpenalty % penalty is now configurable
180179
\vspace\lst@aboveskip
181180
\fi
182181
\fi
183182
\normalbaselines
184183
\abovecaptionskip\lst@abovecaption\relax
185184
\belowcaptionskip\lst@belowcaption\relax
186-
\lst@MakeCaption t%
185+
\let\savedallowbreak\allowbreak
186+
\let\allowbreak\relax
187+
\lst@MakeCaption t% % neuter \allowbreak before non-existing top caption
188+
\let\allowbreak\savedallowbreak
187189
\lsthk@PreInit \lsthk@Init
188190
\lst@ifdisplaystyle
189191
\global\let\lst@ltxlabel\@empty

0 commit comments

Comments
 (0)