From 4096e0a6945f3e0d47f8e47a624ad58e89f12b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Sun, 10 Jul 2022 14:30:24 +0200 Subject: [PATCH] LaTeX (contd) fix mix-up of bottom and left for warning notice --- doc/latex.rst | 142 ++++++++++++++++++++---------------- sphinx/texinputs/sphinx.sty | 6 +- 2 files changed, 84 insertions(+), 64 deletions(-) diff --git a/doc/latex.rst b/doc/latex.rst index 5ad2a83a60..f56a243097 100644 --- a/doc/latex.rst +++ b/doc/latex.rst @@ -8,21 +8,25 @@ LaTeX customization \begingroup \sphinxsetup{% - pre_border-width=2pt, - pre_padding=5pt, - pre_border-radius=5pt, - pre_background-TeXcolor={named}{OldLace}, - pre_border-TeXcolor={named}{Gold}, - TitleColor={named}{DarkGoldenrod}, - hintBorderColor={named}{LightCoral}, - attentionborder=3pt, - attentionBorderColor={named}{Crimson}, - attentionBgColor={named}{FloralWhite}, - noteborder=2pt, - noteBorderColor={named}{Olive}, - div.caution_border-width=3pt, - div.caution_border-TeXcolor={named}{Cyan}, - div.caution_background-TeXcolor={named}{LightCyan}} + TitleColor={named}{DarkGoldenrod}, + pre_border-width=2pt, + pre_padding=5pt, + pre_border-radius=5pt, + pre_background-TeXcolor={named}{OldLace}, + pre_border-TeXcolor={named}{Gold}, + div.warning_border-width=3pt, + div.warning_padding-right=18pt, + div.warning_padding-bottom=18pt, + div.warning_border-TeXcolor={named}{DarkCyan}, + div.warning_background-TeXcolor={named}{LightCyan}, + div.warning_box-shadow=-12pt -12pt inset, + div.warning_box-shadow-TeXcolor={named}{Cyan}, + attentionborder=3pt, + attentionBorderColor={named}{Crimson}, + attentionBgColor={named}{FloralWhite}, + noteborder=2pt, + noteBorderColor={named}{Olive}, + hintBorderColor={named}{LightCoral}} \relax Unlike :ref:`the HTML builders `, the ``latex`` builder does not @@ -586,23 +590,40 @@ start of the chapter:: \begingroup \sphinxsetup{% - pre_border-width=2pt,% alias name of verbatimborder - pre_padding=5pt,% alias name of verbatimsep + TitleColor={named}{DarkGoldenrod}, + % pre_border-width is 5.1.0 alias for verbatimborder + pre_border-width=2pt, + % pre_padding is 5.1.0 alias for verbatimsep + pre_padding=5pt, + % rounded boxes are new at 5.1.0 pre_border-radius=5pt, + % TeXcolor means syntax must be as for LaTeX \definecolor pre_background-TeXcolor={named}{OldLace}, pre_border-TeXcolor={named}{Gold}, - TitleColor={named}{DarkGoldenrod}, - hintBorderColor={named}{LightCoral}, - attentionborder=3pt,% or div.attention_border-width - attentionBorderColor={named}{Crimson},% div.attention_border-TeXcolor - attentionBgColor={named}{FloralWhite},% div.attention_background-TeXcolor + % + % 5.1.0 alias for warningborder + div.warning_border-width=3pt, + div.warning_padding-right=18pt, + div.warning_padding-bottom=18pt, + div.warning_border-TeXcolor={named}{DarkCyan}, + div.warning_background-TeXcolor={named}{LightCyan}, + div.warning_box-shadow=-12pt -12pt inset, + div.warning_box-shadow-TeXcolor={named}{Cyan}, + % + % 5.1.0 new name would be div.attention_border-width + attentionborder=3pt, + % same as div.attention_border-TeXcolor + attentionBorderColor={named}{Crimson}, + % same as div.attention_background-TeXcolor + attentionBgColor={named}{FloralWhite}, + % + % no CSS-like names yet at 5.1.0 for note-type admonitions noteborder=2pt, noteBorderColor={named}{Olive}, - div.caution_border-width=3pt,% alias for cautionborder - div.caution_border-TeXcolor={named}{Cyan}, - div.caution_background-TeXcolor={named}{LightCyan}% + hintBorderColor={named}{LightCoral}% } + And this is placed at the end of the chapter source to end the scope of the configuration:: @@ -1012,7 +1033,7 @@ Options for code-blocks: - and ``pre_box-shadow-TeXcolor`` must all be of the format as accepted by LaTeX ``\definecolor``. They default to ``{rgb}{0,0,0}``, ``{rgb}{1,1,1}`` - and ``{rgb}{0, 0, 0}`` respectively. + and ``{rgb}{0,0,0}`` respectively. If one of the radius parameters is positive, the separate border widths will be ignored and only the value set by ``pre_border-width`` will be used. Also, @@ -1052,7 +1073,7 @@ Options for topic boxes: - ``div.topic_background-TeXcolor``, - ``div.topic_box-shadow-TeXcolor`` must all be of the format as accepted by LaTeX ``\definecolor``. They default to ``{rgb}{0,0,0}``, ``{rgb}{1,1,1}`` - and ``{rgb}{0, 0, 0}`` respectively. + and ``{rgb}{0,0,0}`` respectively. Options for warning directive: @@ -1083,7 +1104,7 @@ Options for warning directive: - ``div.warning_background-TeXcolor``, - ``div.warning_box-shadow-TeXcolor`` must all be of the format as accepted by LaTeX ``\definecolor``. They default to ``{rgb}{0,0,0}``, ``{rgb}{1,1,1}`` - and ``{rgb}{0, 0, 0}`` respectively. + and ``{rgb}{0,0,0}`` respectively. Exactly the same options with same defaults are available with ``warning`` replaced by one of ``caution``, ``attention``, ``danger``, ``error``. @@ -1109,39 +1130,38 @@ Here is a random example which has been tested: latex_elements = { 'sphinxsetup': """% - % VerbatimColor={RGB}{242,242,242},% old option, still available - pre_background-TeXcolor={RGB}{242,242,242},% - pre_border-TeXcolor={RGB}{32,32,32},% - pre_box-decoration-break=slice, - % pre_border-top-width=5pt,% will be ignored due to non-zero radii - % pre_border-right-width=10pt, - % pre_border-bottom-width=15pt, - % pre_border-left-width=20pt, - pre_border-width=3pt,% sets equally the four border-widths, - % needed for rounded corners - pre_border-top-left-radius=20pt, - pre_border-top-right-radius=0pt, - pre_border-bottom-right-radius=20pt, - pre_border-bottom-left-radius=0pt, - pre_box-shadow=10pt 10pt, - pre_box-shadow-TeXcolor={RGB}{192,192,192}, - % - div.topic_border-TeXcolor={RGB}{102,102,102},% - div.topic_box-shadow-TeXcolor={RGB}{187,187,187},% - div.topic_background-TeXcolor={RGB}{238,238,255},% - div.topic_border-bottom-right-radius=10pt,% - div.topic_border-top-right-radius=10pt,% - div.topic_border-width=2pt,% - div.topic_box-shadow=10pt 10pt,% - % - div.danger_border-width=10pt,% - div.danger_background-TeXcolor={rgb}{0.6,.8,0.8},% - div.danger_border-TeXcolor={RGB}{64,64,64},% - div.danger_box-shadow=-7pt 7pt,% - div.danger_box-shadow-TeXcolor={RGB}{192,192,192},% - div.danger_border-bottom-left-radius=15pt,% - """, - } + pre_background-TeXcolor={RGB}{242,242,242},% alias of VerbatimColor + pre_border-TeXcolor={RGB}{32,32,32},% + pre_box-decoration-break=slice, + % pre_border-top-width=5pt,% will be ignored due to non-zero radii + % pre_border-right-width=10pt, + % pre_border-bottom-width=15pt, + % pre_border-left-width=20pt, + pre_border-width=3pt,% sets equally the four border-widths, + % needed for rounded corners + pre_border-top-left-radius=20pt, + pre_border-top-right-radius=0pt, + pre_border-bottom-right-radius=20pt, + pre_border-bottom-left-radius=0pt, + pre_box-shadow=10pt 10pt, + pre_box-shadow-TeXcolor={RGB}{192,192,192}, + % + div.topic_border-TeXcolor={RGB}{102,102,102},% + div.topic_box-shadow-TeXcolor={RGB}{187,187,187},% + div.topic_background-TeXcolor={RGB}{238,238,255},% + div.topic_border-bottom-right-radius=10pt,% + div.topic_border-top-right-radius=10pt,% + div.topic_border-width=2pt,% + div.topic_box-shadow=10pt 10pt,% + % + div.danger_border-width=10pt,% + div.danger_background-TeXcolor={rgb}{0.6,.8,0.8},% + div.danger_border-TeXcolor={RGB}{64,64,64},% + div.danger_box-shadow=-7pt 7pt,% + div.danger_box-shadow-TeXcolor={RGB}{192,192,192},% + div.danger_border-bottom-left-radius=15pt% + """, + } In future, it is hoped to add further CSS properties such as ``font`` or ``color``. diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 4ba33e2b4a..3410aae142 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -435,8 +435,8 @@ \csname spx@opt@#1border\expandafter\endcsname \csname spx@#1@border@top\expandafter\endcsname \csname spx@#1@border@right\expandafter\endcsname - \csname spx@#1@border@left\expandafter\endcsname \csname spx@#1@border@bottom\expandafter\endcsname + \csname spx@#1@border@left\expandafter\endcsname \csname ifspx@#1@border@open\expandafter\endcsname \csname spx@#1@border@opentrue\expandafter\endcsname \csname spx@#1@border@openfalse\endcsname @@ -467,8 +467,8 @@ \csname spx@#1@padding\expandafter\endcsname \csname spx@#1@padding@top\expandafter\endcsname \csname spx@#1@padding@right\expandafter\endcsname - \csname spx@#1@padding@left\expandafter\endcsname - \csname spx@#1@padding@bottom\endcsname + \csname spx@#1@padding@bottom\expandafter\endcsname + \csname spx@#1@padding@left\endcsname {#1}% }% \def\spx@tempb #1#2#3#4#5#6{%