Skip to content

Commit

Permalink
Fix sphinx-doc#11074: Can't change sphinxnote to use sphinxheavybox
Browse files Browse the repository at this point in the history
  • Loading branch information
jfbu committed Jan 3, 2023
1 parent bfd95da commit 807be49
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -18,6 +18,8 @@ Bugs fixed

* #6744: LaTeX: support for seealso directive should be via an environment
to allow styling.
* #11074: LaTeX: Can't change sphinxnote to use sphinxheavybox starting with
5.1.0

Testing
--------
Expand Down
39 changes: 39 additions & 0 deletions sphinx/texinputs/sphinxlatexadmonitions.sty
Expand Up @@ -126,10 +126,49 @@
\fi\@nameuse{fi}%
\sphinxcolorlet{spx@boxes@shadowcolor}{sphinx\spx@noticetype ShadowColor}%
}
% rescue code in case sphinxheavybox is used for note-like notices
% (executed if there is no radius.topleft associated macro)
\def\spx@admonitions@boxes@fcolorbox@setup@fallback{%
\spx@boxes@border@top \spx@notice@border
\spx@boxes@border@right \spx@notice@border
\spx@boxes@border@bottom\spx@notice@border
\spx@boxes@border@left \spx@notice@border
\spx@boxes@border \spx@notice@border
% legacy behavior for padding
\spx@boxes@padding@top \dimexpr.6\baselineskip-\spx@notice@border\relax
\spx@boxes@padding@right \spx@boxes@padding@top
\spx@boxes@padding@bottom\spx@boxes@padding@top
\spx@boxes@padding@left \spx@boxes@padding@top
% straight corners
\spx@boxes@radius@topleft \z@
\spx@boxes@radius@topright \z@
\spx@boxes@radius@bottomright \z@
\spx@boxes@radius@bottomleft \z@
% legacy has no shadow
\spx@boxes@withshadowfalse
\spx@boxes@insetshadowfalse
\spx@boxes@withshadowcolorfalse
% assume background color although there is no public interface,
% sphinxnoteBgColor et al. are defined above and let to white
\spx@boxes@withbackgroundcolortrue
\sphinxcolorlet{spx@boxes@backgroundcolor}{spx@notice@bgcolor}%
% assume always with border color (for simplicity sake, again, and this
% time there is a public interface)
\spx@boxes@withbordercolortrue
\sphinxcolorlet{spx@boxes@bordercolor}{spx@notice@bordercolor}%
}
% Code adapted from framed.sty's "snugshade" environment.
% Nesting works (inner frames do not allow page breaks).
\newenvironment{sphinxheavybox}{\par
\ifcsname spx@\spx@noticetype @radius@topleft\endcsname
\expandafter\@firstoftwo
\else
% attempt to use sphinxheavybox without the circa 20 needed style
% parameters, i.e., for one of the light notice types
\expandafter\@secondoftwo
\fi
\spx@admonitions@boxes@fcolorbox@setup
\spx@admonitions@boxes@fcolorbox@setup@fallback
% Those are used by sphinxVerbatim if the \ifspx@inframed boolean is true
\setlength{\FrameRule}{0.5\dimexpr\spx@boxes@border@top+\spx@boxes@border@bottom\relax}%
% MEMO: prior to 5.1.0 \FrameSep was determined as 0.6\baselineskip -
Expand Down

0 comments on commit 807be49

Please sign in to comment.