Skip to content

Commit e347e59

Browse files
authored
Fix #13939: LaTeX: page break after admonition title (#13988)
1 parent 465b758 commit e347e59

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ Bugs fixed
132132
directly defined in certain cases, depending on autodoc processing
133133
order.
134134
Patch by Jeremy Maitin-Shepard.
135+
* #13939: LaTeX: page break can separate admonition title from contents.
136+
Patch by Jean-François B.
135137

136138

137139
Testing

sphinx/texinputs/sphinxlatexadmonitions.sty

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%% NOTICES AND ADMONITIONS
22
%
33
% change this info string if making any custom modification
4-
\ProvidesPackage{sphinxlatexadmonitions}[2025/04/24 v8.3.0 admonitions]
4+
\ProvidesPackage{sphinxlatexadmonitions}[2025/10/24 v8.3.0 admonitions]
55

66
% Provides support for this output mark-up from Sphinx latex writer:
77
%
@@ -53,6 +53,7 @@
5353
% - \spx@boxes@fcolorbox@setup from sphinxpackageboxes.sty
5454
%
5555
\RequirePackage{framed}
56+
\RequirePackage{needspace}
5657
% Those are required either before or after by sphinx.sty anyhow, but for
5758
% clarity we list them here:
5859
\RequirePackage{sphinxlatexgraphics}
@@ -107,7 +108,12 @@
107108
%
108109
% Code adapted from framed.sty's "snugshade" environment.
109110
% Nesting works (inner frames do not allow page breaks).
111+
%
112+
% At 8.3.0, avoid admonition title getting separated from contents at a
113+
% page break.
114+
\newcommand\sphinxheavyboxneedspacecommand{\needspace{5\baselineskip}}
110115
\newenvironment{sphinxheavybox}{\par
116+
\sphinxheavyboxneedspacecommand
111117
% (MEMO: it is not a problem here if there is no sphinx<type>ShadowColor,
112118
% as it used only if set)
113119
\spx@boxes@fcolorbox@setup{\spx@noticetype}%

0 commit comments

Comments
 (0)