Closed Torxed closed 6 months ago
I might misunderstand what the border radius note actually means.
And if so, is the intended usage to renewenvironment
for sphinxheavybox
?
It feels a bit complex, and if so perhaps a workaround is to use tcolorbox, but that means we would have to rely on .. raw:: latex
to build the warning boxes instead of rest .. warning::
?
IIRC, using tcolorbox
means using tikz
and this comes at some cost we want to avoid.
@jfbu can you perhaps clarify the usage?
A priori you should use the latex_elements['sphinxsetup']
key like this in conf.py for example
latex_elements = {
'sphinxsetup': r"""
div.warning_border-width=3pt,
div.warning_border-radius=5pt,
div.warning_padding=10pt,
""",
}
and the your example gives this
It is also possible to use \sphinxsetup
inside raw latex for exceptional decorations to one particular warning.
It all works. Did you try as proposed here?
@picnixz I will wait to see if really this question is about using tcolorbox
which is an option for people knowledgeable in LaTeX; they only need indeed to renewenvironment sphinxheavybox appropriately.
@jfbu div.warning_border-radius=3pt,
works like a charm and is in my case the preferred solution.
Any reason border-radius
isn't mentioned in https://www.sphinx-doc.org/en/master/latex.html#additional-css-like-sphinxsetup-keys?
<prefix>_border-top-width, <prefix>_border-right-width, <prefix>_border-bottom-width, <prefix>_border-left-width, <prefix>_border-width. The latter can (currently) be only a single dimension which then sets all four others.
With some guessing game I should probably have figured out the syntax, but perhaps either mention it in the above linked section or https://www.sphinx-doc.org/en/master/latex.html#the-sphinxsetup-configuration-setting to avoid confusion with pre_border-radius
(which I now understand is the <pre>
tag?)
Also thank you for the help and clarification, this helped a lot!
Actually, the border-radius
is mentioned three sections below since it's not part of the customization of border's widths. But as you can see, I didn't even know that we could do that in Sphinx.
@Torxed As pointed out by @picnixz it was mentioned indeed
| <prefix>_border-top-left-radius
,
| <prefix>_border-top-right-radius
,
| <prefix>_border-bottom-right-radius
,
| <prefix>_border-bottom-left-radius
,
| <prefix>_border-radius
. This last key sets the first four to
its assigned value. Each key value can be either a single, or two,
dimensions which are then space separated.
The default is that all four corners are either circular or straight, with common radii:
\fboxsep
(i.e. a priori 3pt
) for :rst:dir:code-block
(since 6.0.0).0pt
for all other directives; this means to use straight corners.See a remark above about traps with spaces in LaTeX.
But writing good documentation is hard! I realize perhaps I am confusing people in providing raw latex examples which in practice are only to allow advanced users achieve special effects. As for example Sphinx-doc maintainers obtain in the PDF docs of Sphinx itself a special rendering in PDF output for that chapter of the documentation devoted to LaTeX+PDF...
Damn, yepp it sure is mentioned! I don't know how the heck my ctrl-f didn't pick up radius
, I must have searched for radious
or something super silly. Completely my fault and I apologize for the noise. This could have been a StackOverflow post for sure.
perhaps I am confusing people in providing raw latex examples
I think I might be a unique schmuck here hehe, the docs are well written. I'm pretty practical and tend to favor examples and that's on me. If anything, perhaps in the example comments found in the example of https://www.sphinx-doc.org/en/master/latex.html#the-sphinxsetup-configuration-setting - in the top perhaps mention the <prefix>_
style/information as that was a bit of a "ofcourse!" moment. But it's very well mentioned and explained in https://www.sphinx-doc.org/en/master/latex.html#additional-css-like-sphinxsetup-keys so with some digging and actually following the manual users will find it eventually.
I'll go ahead and close this issue tho, as it was a user error on my part.
Describe the bug
Following https://www.sphinx-doc.org/en/master/latex.html#the-sphinxsetup-configuration-setting, setting, I expected rounded corners on
.. warning
and other boxes:The following however generates a square warning box.
How to Reproduce
Environment Information
Sphinx extensions
Additional context