Le 19/10/2019 à 00:27, Jeff Larson a écrit :
This is outstanding for Note admonitions. Is the same thing possible for the 
seealso directive?
https://www.sphinx-doc.org/en/1.5/markup/para.html#directive-seealso



Only now realizing I missed saying the obvious !

There is a famous LaTeX package tcolorbox which provides out of the box (sic) 
boxes (possibly breakable) with fancy decorations such as rounded corners etc...

Sphinx LaTeX does not use it, but if Sphinx LaTeX was written from scratch in 
2019 it probably would.

So for example to customize looks of Note admonitions in PDF you can go 
something like this

latex_elements = {
    'preamble': r"""
\usepackage{tcolorbox}
\definecolor{sphinxnoteBgColor}{RGB}{221,233,239}
\renewenvironment{sphinxnote}[1]
  {\begin{tcolorbox}[colback=sphinxnoteBgColor,
                     colframe=red!75!black,
                     title=\sphinxstrong{#1}]}
  {\end{tcolorbox}}
""",
}


The title defaults to "Note:" (and is localized to the language), but of course
you can use anything you like in place of "#1" above.

Don't forget the [1] which means the environment has a mandatory
argument (which you must grab but are free to use or not, it is the #1).

Anyway, you can get very nice colored boxes this way, up to the price
of a slightly slower PDF build time, and more disk resources and
necessity to have a complete TeX installation.

As I said in my very first reply, since Sphinx 1.5 you can
do the following above kind of things separately for each
admonition type.

But you should avoid redefining the "sphinxadmonition" environment
itself.

Side note: for the seealso directive I opened up a ticket
at the github repo and will make a PR to enhance the Sphinx
LaTeX with a sphinxseealso
environment.

Then you are free to redefine the environment
to use a tcolorbox as above and obtain spectacular
"see also" notices.

PS: the tcolorbox manual is 513 pages long... but I basically
copied pasted the first concrete example I found in it, and I
found it on page 12.

tcolorbox environments have zillions of options...

Best,

Jean-François

--
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/qofr3o%2435or%241%40blaine.gmane.org.

Reply via email to