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 committed Sep 27, 2024
1 parent 8579909 commit 1552966
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 vertial 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 1552966

Please sign in to comment.