Skip to content

Commit

Permalink
LaTeX (contd) fix mix-up of bottom and left for warning notice
Browse files Browse the repository at this point in the history
  • Loading branch information
jfbu committed Jul 10, 2022
1 parent d59dc08 commit 4096e0a
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 64 deletions.
142 changes: 81 additions & 61 deletions doc/latex.rst
Expand Up @@ -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 <html-themes>`, the ``latex`` builder does not
Expand Down Expand Up @@ -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::

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:

Expand Down Expand Up @@ -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``.
Expand All @@ -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``.
Expand Down
6 changes: 3 additions & 3 deletions sphinx/texinputs/sphinx.sty
Expand Up @@ -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
Expand Down Expand Up @@ -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{%
Expand Down

0 comments on commit 4096e0a

Please sign in to comment.