Skip to content

Commit 9225f4e

Browse files
jensmaurertkoeppe
authored andcommitted
[macros] Avoid page break between section heading and grammar snippet
1 parent afdd158 commit 9225f4e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

source/macros.tex

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,17 @@
660660
\setlength{\BnfInc}{\BnfIndent}
661661
\newlength{\BnfRest}
662662
\setlength{\BnfRest}{2\BnfIndent}
663-
\newcommand{\BnfNontermshape}{\small\color{grammar-gray}\sffamily\itshape}
663+
\newcommand{\BnfNontermshape}{%
664+
\small%
665+
\color{grammar-gray}%
666+
% The color setting inserts a \pdfcolorstack entry into the vertical list,
667+
% breaking the connection of the \penalty entry from a preceding heading
668+
% with the \glue entries that precede the grammar snippet.
669+
% Add a penalty here that prevents making those \glue entries page-breaking
670+
% opportunities.
671+
\penalty10000%
672+
\sffamily%
673+
\itshape}
664674
\newcommand{\BnfReNontermshape}{\small\rmfamily\itshape}
665675
\newcommand{\BnfTermshape}{\small\ttfamily\upshape}
666676

0 commit comments

Comments
 (0)