From 9225f4ec2c18b1994aafccb089e7510b30559c4a Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Fri, 27 Sep 2024 17:49:23 +0200 Subject: [PATCH] [macros] Avoid page break between section heading and grammar snippet --- source/macros.tex | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/macros.tex b/source/macros.tex index f257575dca..f6dd90ac33 100644 --- a/source/macros.tex +++ b/source/macros.tex @@ -660,7 +660,17 @@ \setlength{\BnfInc}{\BnfIndent} \newlength{\BnfRest} \setlength{\BnfRest}{2\BnfIndent} -\newcommand{\BnfNontermshape}{\small\color{grammar-gray}\sffamily\itshape} +\newcommand{\BnfNontermshape}{% + \small% + \color{grammar-gray}% + % The color setting inserts a \pdfcolorstack entry into the vertical list, + % breaking the connection of the \penalty entry from a preceding heading + % with the \glue entries that precede the grammar snippet. + % Add a penalty here that prevents making those \glue entries page-breaking + % opportunities. + \penalty10000% + \sffamily% + \itshape} \newcommand{\BnfReNontermshape}{\small\rmfamily\itshape} \newcommand{\BnfTermshape}{\small\ttfamily\upshape}