From de07a2e98ef1a806652bef2802ac2d75488ce118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Fri, 6 Jan 2023 21:54:48 +0100 Subject: [PATCH 1/9] Fix #11096 (LaTeX shadowsize regression at 5.1.0) --- sphinx/texinputs/sphinx.sty | 8 ++++---- sphinx/texinputs/sphinxlatexshadowbox.sty | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index bf7bba2c90e..d7a92d61600 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -6,7 +6,7 @@ % \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{sphinx}[2023/01/03 v6.1.0 LaTeX package (Sphinx markup)] +\ProvidesPackage{sphinx}[2023/01/06 v6.1.2 LaTeX package (Sphinx markup)] % provides \ltx@ifundefined % (many packages load ltxcmds: graphicx does for pdftex and lualatex but @@ -508,10 +508,10 @@ will be set to white}% \edef\spx@topic@shadow@xoffset{\number\dimexpr#1\relax sp}% \let\spx@topic@shadow@yoffset\spx@topic@shadow@xoffset \ifdim\spx@topic@shadow@xoffset=\z@ - \spx@topic@box@withshadowtrue + \spx@topic@withshadowfalse \else - \spx@topic@box@withshadowfalse - \spx@topic@box@shadow@insetfalse + \spx@topic@withshadowtrue + \spx@topic@insetshadowfalse \fi }% \definecolor{sphinxTopicBorderColor}{rgb}{0,0,0} diff --git a/sphinx/texinputs/sphinxlatexshadowbox.sty b/sphinx/texinputs/sphinxlatexshadowbox.sty index 069526717e6..1ccb55f2b96 100644 --- a/sphinx/texinputs/sphinxlatexshadowbox.sty +++ b/sphinx/texinputs/sphinxlatexshadowbox.sty @@ -1,7 +1,7 @@ %% TOPIC AND CONTENTS BOXES % % change this info string if making any custom modification -\ProvidesFile{sphinxlatexshadowbox.sty}[2022/07/03 sphinxShadowBox] +\ProvidesFile{sphinxlatexshadowbox.sty}[2023/01/06 sphinxShadowBox] % Provides support for this output mark-up from Sphinx latex writer: % From aed92cd96e3804222be980098512f7e61297d421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Fri, 6 Jan 2023 21:56:14 +0100 Subject: [PATCH 2/9] LaTeX partial check that some sphinxsetup keys do not break PDF build --- tests/roots/test-root/conf.py | 72 +++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/tests/roots/test-root/conf.py b/tests/roots/test-root/conf.py index 6583fbb80eb..f54547adbe5 100644 --- a/tests/roots/test-root/conf.py +++ b/tests/roots/test-root/conf.py @@ -38,6 +38,78 @@ html_context = {'hckey': 'hcval', 'hckey_co': 'wrong_hcval_co'} latex_additional_files = ['svgimg.svg'] +# some random pdf layout parameters to check they don't break build +latex_elements = { + 'sphinxsetup': """ + verbatimwithframe, + verbatimwrapslines, + verbatimforcewraps, + verbatimmaxoverfull=1, + verbatimmaxunderfull=5, + verbatimhintsturnover=true, + verbatimcontinuesalign=l, + VerbatimColor={RGB}{242,242,242}, + VerbatimBorderColor={RGB}{32,32,32}, + VerbatimHighlightColor={RBB}{200,200,200}, + pre_box-decoration-break=slice, + pre_border-top-left-radius=20pt, + pre_border-top-right-radius=0pt, + pre_border-bottom-right-radius=20pt, + pre_border-bottom-left-radius=0pt, + verbatimsep=1pt, + pre_padding=5pt,% alias to verbatimsep + pre_border-top-width=5pt, + pre_border-right-width=10pt, + pre_border-bottom-width=15pt, + pre_border-left-width=20pt, + pre_border-width=3pt,% overrides all previous four + verbatimborder=2pt,% alias to pre_border-width +% + shadowrule=1pt, + shadowsep=10pt, + shadowsize=10pt, + div.topic_border-width=2pt,% alias to shadowrule + div.topic_padding=6pt,% alias to shadowsep + div.topic_box-shadow=5pt,% overrides/alias shadowsize +% + noteBorderColor={RGB}{204,204,204}, + hintBorderColor={RGB}{204,204,204}, + importantBorderColor={RGB}{204,204,204}, + tipBorderColor={RGB}{204,204,204}, +% + noteborder=5pt, + hintborder=5pt, + importantborder=5pt, + tipborder=5pt, +% + warningborder=3pt, + cautionborder=3pt, + attentionborder=3pt, + errorborder=3pt, +% + dangerborder=3pt, + div.danger_border-width=10pt, + div.danger_background-TeXcolor={rgb}{0,1,0}, + div.danger_border-TeXcolor={rgb}{0,0,1}, + div.danger_box-shadow=20pt -20pt, + div.danger_box-shadow-TeXcolor={rgb}{0.5,0.5,0.5}, +% + warningBorderColor={RGB}{255,119,119}, + cautionBorderColor={RGB}{255,119,119}, + attentionBorderColor={RGB}{255,119,119}, + dangerBorderColor={RGB}{255,119,119}, + errorBorderColor={RGB}{255,119,119}, + warningBgColor={RGB}{255,238,238}, + cautionBgColor={RGB}{255,238,238}, + attentionBgColor={RGB}{255,238,238}, + dangerBgColor={RGB}{255,238,238}, + errorBgColor={RGB}{255,238,238}, +% + TableRowColorHeader={rgb}{0,1,0}, + TableRowColorOdd={rgb}{0.5,0,0}, + TableRowColorEven={rgb}{0.1,0.1,0.1}, +""", +} coverage_c_path = ['special/*.h'] coverage_c_regexes = {'function': r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'} From 86f6c86c5ed438ddd1a373712014577d459d2962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Fri, 6 Jan 2023 22:13:32 +0100 Subject: [PATCH 3/9] Update LaTeX docs --- doc/latex.rst | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/doc/latex.rst b/doc/latex.rst index 5ce00016fd0..e020ceb27c5 100644 --- a/doc/latex.rst +++ b/doc/latex.rst @@ -933,10 +933,14 @@ Do not use quotes to enclose values, whether numerical or strings. ``verbatimsep`` The separation between code lines and the frame. + See :ref:`additionalcss` for its alias ``pre_padding`` and + additional keys. + Default: ``\fboxsep`` ``verbatimborder`` - The width of the frame around :rst:dir:`code-block`\ s. + The width of the frame around :rst:dir:`code-block`\ s. See also + :ref:`additionalcss` for ``pre_border-width``. Default: ``\fboxrule`` @@ -944,15 +948,26 @@ Do not use quotes to enclose values, whether numerical or strings. The separation between contents and frame for :dudir:`contents` and :dudir:`topic` boxes. + See :ref:`additionalcss` for the alias ``div.topic_padding``. + Default: ``5pt`` ``shadowsize`` The width of the lateral "shadow" to the right and bottom. + See :ref:`additionalcss` for ``div.topic_box-shadow`` which allows to + configure separately the widths of the vertical and horizontal shadows. + Default: ``4pt`` + .. versionchanged:: 6.1.2 + Fixed a regression introduced at `5.1.0` which modified unintentionally + the width of topic boxes and worse had made usage of this key break PDF + builds. + ``shadowrule`` - The width of the frame around :dudir:`topic` boxes. + The width of the frame around :dudir:`topic` boxes. See also + :ref:`additionalcss` for ``div.topic_border-width``. Default: ``\fboxrule`` @@ -987,7 +1002,9 @@ Do not use quotes to enclose values, whether numerical or strings. Default: ``{rgb}{1,1,1}`` (white) |warningborders| - The width of the frame. + The width of the frame. See + :ref:`additionalcss` for keys allowing to configure separately each + border width. Default: ``1pt`` From 291d072f11cbc7177df15f8e9024291e94282298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Fri, 6 Jan 2023 22:25:55 +0100 Subject: [PATCH 4/9] Fix #11095 (PDF wrong placement of shadow of topic boxes since 5.1.0) modified: sphinx/texinputs/sphinxlatexshadowbox.sty --- sphinx/texinputs/sphinxlatexshadowbox.sty | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sphinx/texinputs/sphinxlatexshadowbox.sty b/sphinx/texinputs/sphinxlatexshadowbox.sty index 1ccb55f2b96..96146f0fc74 100644 --- a/sphinx/texinputs/sphinxlatexshadowbox.sty +++ b/sphinx/texinputs/sphinxlatexshadowbox.sty @@ -89,7 +89,9 @@ \fi \ifspx@topic@withshadow \ifspx@topic@insetshadow\else - \ifdim\spx@topic@shadow@xoffset>\z@\hskip\spx@topic@shadow@xoffset\relax + % A strangely unnoticed 5.1.0 breakage of the legacy placement of the + % shadow was caused by a lacking minus sign here, fixed at 6.1.2 + \ifdim\spx@topic@shadow@xoffset>\z@\hskip-\spx@topic@shadow@xoffset\relax \fi \fi \fi From a102a667a591a8602d557b9ab41f794d99a4b3b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Fri, 6 Jan 2023 22:34:38 +0100 Subject: [PATCH 5/9] Update CHANGES --- CHANGES | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGES b/CHANGES index 03a0f27fa67..1de9cb7ccd0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,16 @@ +Release 6.1.2 (in development) +============================== + +Bugs fixed +---------- + +* #11096: LaTeX: shadowsize key of sphinxsetup causes PDF build to crash + since Sphinx 5.1.0 +* #11095: LaTeX: shadow of :dudir:`topic` and contents_ boxes not in page + margin since Sphinx 5.1.0 + + .. _contents: https://docutils.sourceforge.io/docs/ref/rst/directives.html#table-of-contents + Release 6.1.1 (released Jan 05, 2023) ===================================== From d900810e3784021dfc054d4ee80e4d9633c73848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Fri, 6 Jan 2023 22:50:51 +0100 Subject: [PATCH 6/9] Can not use :dudir:`contents` has it links to wrong place --- doc/latex.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/latex.rst b/doc/latex.rst index e020ceb27c5..1d7922ba489 100644 --- a/doc/latex.rst +++ b/doc/latex.rst @@ -945,13 +945,15 @@ Do not use quotes to enclose values, whether numerical or strings. Default: ``\fboxrule`` ``shadowsep`` - The separation between contents and frame for :dudir:`contents` and + The separation between contents and frame for contents_ and :dudir:`topic` boxes. See :ref:`additionalcss` for the alias ``div.topic_padding``. Default: ``5pt`` + .. _contents: https://docutils.sourceforge.io/docs/ref/rst/directives.html#table-of-contents + ``shadowsize`` The width of the lateral "shadow" to the right and bottom. @@ -1456,7 +1458,7 @@ Environments .. versionadded:: 6.1.0 -- The :dudir:`contents` directive (with ``:local:`` option) and the +- The contents_ directive (with ``:local:`` option) and the :dudir:`topic` directive are implemented by environment ``sphinxShadowBox``. .. versionadded:: 1.4.2 From 7921058bfd57a82687bf7788d5cbfdb83aa7b9c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Fri, 6 Jan 2023 23:07:33 +0100 Subject: [PATCH 7/9] Fix #11099 (shadowrule legacy sphinxsetup key vanished at 5.1.0) --- CHANGES | 2 ++ sphinx/texinputs/sphinx.sty | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 1de9cb7ccd0..c32b0f6160b 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,8 @@ Release 6.1.2 (in development) Bugs fixed ---------- +* #11099: LaTeX: shadowrule key of sphinxsetup causes PDF build to crash + since Sphinx 5.1.0 * #11096: LaTeX: shadowsize key of sphinxsetup causes PDF build to crash since Sphinx 5.1.0 * #11095: LaTeX: shadow of :dudir:`topic` and contents_ boxes not in page diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index d7a92d61600..cd3c30c505f 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -436,7 +436,7 @@ will be set to white}% \let\spx@topic@border@bottom\spx@topic@border@top \let\spx@topic@border@left \spx@topic@border@top \expandafter\let\expandafter\KV@sphinx@shadowrule - \csname KV@sphinx@topic_border-width\endcsname + \csname KV@sphinx@div.topic_border-width\endcsname \newif\ifspx@topic@border@open % defaults to false (legacy) \define@key{sphinx}{div.topic_box-decoration-break}% {\begingroup\edef\spx@tempa{#1}\expandafter\endgroup From 0448cb7e3de93051366780311937e6f364c94a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Fri, 6 Jan 2023 23:25:43 +0100 Subject: [PATCH 8/9] Fix #11101 (LaTeX div.topic_padding of sphinxsetup had wrong name) --- CHANGES | 6 ++++-- doc/latex.rst | 4 ++++ sphinx/texinputs/sphinx.sty | 15 +++++++++------ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index c32b0f6160b..51147663be4 100644 --- a/CHANGES +++ b/CHANGES @@ -4,9 +4,11 @@ Release 6.1.2 (in development) Bugs fixed ---------- -* #11099: LaTeX: shadowrule key of sphinxsetup causes PDF build to crash +* #11101: LaTeX: ``div.topic_padding`` key of sphinxsetup documented at 5.1.0 was + implemented with name ``topic_padding`` +* #11099: LaTeX: ``shadowrule`` key of sphinxsetup causes PDF build to crash since Sphinx 5.1.0 -* #11096: LaTeX: shadowsize key of sphinxsetup causes PDF build to crash +* #11096: LaTeX: ``shadowsize`` key of sphinxsetup causes PDF build to crash since Sphinx 5.1.0 * #11095: LaTeX: shadow of :dudir:`topic` and contents_ boxes not in page margin since Sphinx 5.1.0 diff --git a/doc/latex.rst b/doc/latex.rst index 1d7922ba489..53c3350f027 100644 --- a/doc/latex.rst +++ b/doc/latex.rst @@ -1165,6 +1165,10 @@ Options for topic boxes: | ``div.topic_padding-left``, | ``div.topic_padding``, again this is a single dimension. Its default is ``5pt``. + + .. versionchanged:: 6.1.2 + These keys had been implemented at 5.1.0 without ``div.`` in + their names. - | ``div.topic_border-top-left-radius``, | ``div.topic_border-top-right-radius``, | ``div.topic_border-bottom-right-radius``, diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index cd3c30c505f..618ee0b90b7 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -445,11 +445,13 @@ will be set to white}% \else\spx@topic@border@opentrue\fi}% % % MEMO: \sphinxshadowsep not used anywhere anymore in code base and to be removed -\define@key{sphinx}{topic_padding-top}{\def\spx@topic@padding@top{#1}} -\define@key{sphinx}{topic_padding-right}{\def\spx@topic@padding@right{#1}} -\define@key{sphinx}{topic_padding-bottom}{\def\spx@topic@padding@bottom{#1}} -\define@key{sphinx}{topic_padding-left}{\def\spx@topic@padding@left{#1}} -\define@key{sphinx}{topic_padding}{% +% Sadly the 5.1.0 definitions forgot the "div." part of the key names +% Fixed at 6.1.2 +\define@key{sphinx}{div.topic_padding-top}{\def\spx@topic@padding@top{#1}} +\define@key{sphinx}{div.topic_padding-right}{\def\spx@topic@padding@right{#1}} +\define@key{sphinx}{div.topic_padding-bottom}{\def\spx@topic@padding@bottom{#1}} +\define@key{sphinx}{div.topic_padding-left}{\def\spx@topic@padding@left{#1}} +\define@key{sphinx}{div.topic_padding}{% \def\spx@topic@padding@top {#1}% \let\spx@topic@padding@right \spx@topic@padding@top \let\spx@topic@padding@bottom\spx@topic@padding@top @@ -460,7 +462,7 @@ will be set to white}% \let\spx@topic@padding@bottom\spx@topic@padding@top \let\spx@topic@padding@left \spx@topic@padding@top \expandafter\let\expandafter\KV@sphinx@shadowsep - \csname KV@sphinx@topic_padding\endcsname + \csname KV@sphinx@div.topic_padding\endcsname % \define@key{sphinx}{div.topic_border-top-left-radius}{\def\spx@topic@radius@topleft{#1}} \define@key{sphinx}{div.topic_border-top-right-radius}{\def\spx@topic@radius@topright{#1}} @@ -504,6 +506,7 @@ will be set to white}% \spx@topic@box@shadow@setter 4pt 4pt {} \@nnil % Suport for legacy shadowsize, the \sphinxshadowsize \dimen register % is not used anymore and should not even be allocated in future +% This definition was broken at 5.1.0 and fixed at 6.1.2 \define@key{sphinx}{shadowsize}{% \edef\spx@topic@shadow@xoffset{\number\dimexpr#1\relax sp}% \let\spx@topic@shadow@yoffset\spx@topic@shadow@xoffset From cef9f049bb804aaf968f641f7bfd34aa34e77b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Fri, 6 Jan 2023 23:34:35 +0100 Subject: [PATCH 9/9] Fix silly typo in tests/roots/test-root/conf.py from recent commit --- tests/roots/test-root/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/roots/test-root/conf.py b/tests/roots/test-root/conf.py index f54547adbe5..154d4d1209c 100644 --- a/tests/roots/test-root/conf.py +++ b/tests/roots/test-root/conf.py @@ -50,7 +50,7 @@ verbatimcontinuesalign=l, VerbatimColor={RGB}{242,242,242}, VerbatimBorderColor={RGB}{32,32,32}, - VerbatimHighlightColor={RBB}{200,200,200}, + VerbatimHighlightColor={RGB}{200,200,200}, pre_box-decoration-break=slice, pre_border-top-left-radius=20pt, pre_border-top-right-radius=0pt,