Skip to content

Commit

Permalink
[macros] Avoid page break between section heading and grammar snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
jensmaurer authored and tkoeppe committed Sep 27, 2024
1 parent afdd158 commit 9225f4e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion source/macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 9225f4e

Please sign in to comment.