From e347e59ccc27a646c974526252e39a63870f6ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B=2E?= <2589111+jfbu@users.noreply.github.com> Date: Fri, 24 Oct 2025 08:57:38 +0200 Subject: [PATCH] Fix #13939: LaTeX: page break after admonition title (#13988) --- CHANGES.rst | 2 ++ sphinx/texinputs/sphinxlatexadmonitions.sty | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 792f6ce220..3a90d66f08 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -132,6 +132,8 @@ Bugs fixed directly defined in certain cases, depending on autodoc processing order. Patch by Jeremy Maitin-Shepard. +* #13939: LaTeX: page break can separate admonition title from contents. + Patch by Jean-François B. Testing diff --git a/sphinx/texinputs/sphinxlatexadmonitions.sty b/sphinx/texinputs/sphinxlatexadmonitions.sty index 627ee0d49a..6b2d45779a 100644 --- a/sphinx/texinputs/sphinxlatexadmonitions.sty +++ b/sphinx/texinputs/sphinxlatexadmonitions.sty @@ -1,7 +1,7 @@ %% NOTICES AND ADMONITIONS % % change this info string if making any custom modification -\ProvidesPackage{sphinxlatexadmonitions}[2025/04/24 v8.3.0 admonitions] +\ProvidesPackage{sphinxlatexadmonitions}[2025/10/24 v8.3.0 admonitions] % Provides support for this output mark-up from Sphinx latex writer: % @@ -53,6 +53,7 @@ % - \spx@boxes@fcolorbox@setup from sphinxpackageboxes.sty % \RequirePackage{framed} +\RequirePackage{needspace} % Those are required either before or after by sphinx.sty anyhow, but for % clarity we list them here: \RequirePackage{sphinxlatexgraphics} @@ -107,7 +108,12 @@ % % Code adapted from framed.sty's "snugshade" environment. % Nesting works (inner frames do not allow page breaks). +% +% At 8.3.0, avoid admonition title getting separated from contents at a +% page break. +\newcommand\sphinxheavyboxneedspacecommand{\needspace{5\baselineskip}} \newenvironment{sphinxheavybox}{\par + \sphinxheavyboxneedspacecommand % (MEMO: it is not a problem here if there is no sphinxShadowColor, % as it used only if set) \spx@boxes@fcolorbox@setup{\spx@noticetype}%