Is it possible to set the background color of different admonitions in the 
PDF generated by Sphinx 3?

Using the StackOverlow answer here as a template: 
https://stackoverflow.com/questions/13530489/adding-background-color-of-notes-to-sphinx-generated-pdf-files/34766700
and motivates me to change the "notice" to "sphinxadmonition" changes the 
original:

[image: Selection_037.png]


to look like:

[image: Selection_038.png]

(Observe that "Note:" has disappeared and the "See Also: is unaffected.)

Explicitly, my conf.py currently contains:

latex_elements = {
     'preamble':
    r'''
    \definecolor{Admonition}{RGB}{221,233,239}

\makeatletter
  \newenvironment{admonitionbox}{
    \begin{lrbox}{\@tempboxa}\begin{minipage}{\columnwidth}
  }{
    \end{minipage}\end{lrbox}
    \colorbox{Admonition}{\usebox{\@tempboxa}}
  }

  \renewenvironment{sphinxadmonition}[2]{
    \begin{admonitionbox}
  }{
    \end{admonitionbox}
  }
\makeatother



Ideally, I could have different colors for different admonitions, but I 
understand that that may not be possible.

Thank you

-- 
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/f8771b07-b9ef-4a17-9833-e47c493d707d%40googlegroups.com.

Reply via email to