[sphinx-users] Re: Adding background color of notes and attention to Sphinx-generated PDF files

2016-10-16 Thread Peter Burdine
\usepackage{xcolor}

...

\makeatletter
\definecolor{shadecolor}{RGB}{220,220,220}

...

\renewcommand{\py@noticestart@note}{\py@lightbox\begin{snugshade*}}
\renewcommand{\py@noticeend@note}{\end{snugshade*}\py@endlightbox}

...

\makeatother

Adding the above to your preamble will enable "notes" to have a background 
color.  Using the above, you should be able to figure out the other 
admonitions.  Note that this is only one method of doing it, I'm sure there 
are others.

On Wednesday, October 12, 2016 at 5:33:15 PM UTC-7, Peter Burdine wrote:
>
> This is where you need to learn about LaTeX.  Those commands include the 
> character '@', so you need "\makeatletter" before those commands and 
> "\makeatother" after those commands.  The @ sign is a special character in 
> LaTeX, so you need to tell the system that you are using it as a letter, 
> then put it back into the regular mode.  I don't recall the special terms 
> that I should be using here, but hopefully the point comes across.
>
> On Wednesday, October 12, 2016 at 1:04:29 AM UTC-7, Minkai Li wrote:
>>
>> I add this commands to my conf.py preamble,But it does not work. It can 
>> not compile. I use restructuredtext and sphinx in Ubuntu environment
>>
>> 在 2016年10月12日星期三 UTC+8上午7:34:18,Peter Burdine写道:
>>>
>>> You will need to add some Latex commands to your preamble.  For example, 
>>> the following will make notes centered:
>>> \renewcommand{\py@noticestart@note}{\py@lightbox\begin{center}}
>>> \renewcommand{\py@noticeend@note}{\end{center}\py@endlightbox}
>>>
>>> This will make the admonition title be upper case:
>>> \renewenvironment{notice}[2]{
>>>   \def\py@noticetype{#1}
>>>   \csname py@noticestart@#1\endcsname
>>>   % Make the admonition type be upper case and on its own line
>>>   \strong{\MakeUppercase{#2}} \\
>>> }{\csname py@noticeend@\py@noticetype\endcsname}
>>>
>>> Modifying the PDF output of Sphinx isn't easy because you have to do a 
>>> few things:
>>>
>>>- Learn enough Latex to understand the Sphinx style files
>>>- Learn enough Latex to do what you want
>>>- Figure out how to modify it using a preamble that doesn't break 
>>>the output
>>>
>>> So far there isn't any general guide on how to do it.
>>>
>>>
>>> On Monday, October 10, 2016 at 5:10:16 PM UTC-7, Minkai Li wrote:

 I am able to generate notes using the Sphinx directive .. notes:: and 
 .. attention::. However, the notes and the attention in html file have 
 a background color while those from the generated PDF don’t. How can I add 
 color to Sphinx-generated PDF files? Is it in conf.py?

>>>

-- 
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 sphinx-users+unsubscr...@googlegroups.com.
To post to this group, send email to sphinx-users@googlegroups.com.
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.


[sphinx-users] Re: Adding background color of notes and attention to Sphinx-generated PDF files

2016-10-12 Thread Minkai Li
I add this commands to my conf.py preamble,But it does not work. It can not 
compile. I use restructuredtext and sphinx in Ubuntu environment

在 2016年10月12日星期三 UTC+8上午7:34:18,Peter Burdine写道:
>
> You will need to add some Latex commands to your preamble.  For example, 
> the following will make notes centered:
> \renewcommand{\py@noticestart@note}{\py@lightbox\begin{center}}
> \renewcommand{\py@noticeend@note}{\end{center}\py@endlightbox}
>
> This will make the admonition title be upper case:
> \renewenvironment{notice}[2]{
>   \def\py@noticetype{#1}
>   \csname py@noticestart@#1\endcsname
>   % Make the admonition type be upper case and on its own line
>   \strong{\MakeUppercase{#2}} \\
> }{\csname py@noticeend@\py@noticetype\endcsname}
>
> Modifying the PDF output of Sphinx isn't easy because you have to do a few 
> things:
>
>- Learn enough Latex to understand the Sphinx style files
>- Learn enough Latex to do what you want
>- Figure out how to modify it using a preamble that doesn't break the 
>output
>
> So far there isn't any general guide on how to do it.
>
>
> On Monday, October 10, 2016 at 5:10:16 PM UTC-7, Minkai Li wrote:
>>
>> I am able to generate notes using the Sphinx directive .. notes:: and .. 
>> attention::. However, the notes and the attention in html file have a 
>> background color while those from the generated PDF don’t. How can I add 
>> color to Sphinx-generated PDF files? Is it in conf.py?
>>
>

-- 
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 sphinx-users+unsubscr...@googlegroups.com.
To post to this group, send email to sphinx-users@googlegroups.com.
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.