From ce0d1791d680e31eab634195768691fc947321af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B=2E?= <2589111+jfbu@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:44:51 +0200 Subject: [PATCH] LaTeX: avoid large voids sometimes occurring at page bottoms (#12832) --- CHANGES.rst | 2 ++ sphinx/texinputs/sphinxlatexstyleheadings.sty | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 85bf74f26f7..915f35c4014 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -83,6 +83,8 @@ Bugs fixed rise to nested ``\DUrole``'s, rather than a single one with comma separated classes. Patch by Jean-François B. +* #12831: LaTeX: avoid large voids sometimes occurring at page bottoms. + Patch by Jean-François B. * #11970, #12551: singlehtml builder: make target URIs to be same-document references in the sense of :rfc:`RFC 3986, §4.4 <3986#section-4.4>`, e.g., ``index.html#foo`` becomes ``#foo``. diff --git a/sphinx/texinputs/sphinxlatexstyleheadings.sty b/sphinx/texinputs/sphinxlatexstyleheadings.sty index e9121996b42..08773c0b658 100644 --- a/sphinx/texinputs/sphinxlatexstyleheadings.sty +++ b/sphinx/texinputs/sphinxlatexstyleheadings.sty @@ -4,6 +4,12 @@ \ProvidesPackage{sphinxlatexstyleheadings}[2023/02/11 headings] \RequirePackage[nobottomtitles*]{titlesec} +% tests showed that this setting guarantees \section title has +% 3 lines of text following it on same page if near bottom. +\renewcommand\bottomtitlespace{6\baselineskip} +% the default setting of 0.2\textheight is about 11\baselineskip +% (for 10pt letterpaper documents) and may create large voids. + \@ifpackagelater{titlesec}{2016/03/15}% {\@ifpackagelater{titlesec}{2016/03/21}% {}% @@ -47,7 +53,6 @@ \titleformat{\subparagraph}{\normalsize\py@HeaderFamily}% {\py@TitleColor\thesubparagraph}{0.5em}{\py@TitleColor} - % Since Sphinx 1.5, users should use HeaderFamily key to 'sphinxsetup' rather % than defining their own \py@HeaderFamily command (which is still possible). % Memo: \py@HeaderFamily is also used by \maketitle as defined in