Re: Converting a pygments CSS stylesheet to latex
Guenter Milde via Docutils-users <[email protected]> Thu, 17 Jun 2021 06:55:04 -0000 (UTC)
| Newsgroups | gmane.text.docutils.user |
|---|---|
| Message-ID | <[email protected]> |
On 2021-06-16, Jorge Scandaliaris wrote:
> Hi,
> I am writing some documents in ReStructuredText which include source code
> and I want the end result to be in PDF, so I used rst2latex to generate the
> .tex files. I wanted to experiment with different stylesheets so I tried to
> convert pygments CSS stylesheets to LaTeX using the pygments_css2sty.py
> script.
Is this script provided by Pygments or from the Docutils sandbox?
https://docutils.sourceforge.io/sandbox/stylesheets/pygments_css2sty.py
> I post here because my initial attempt failed with an error message from
> the script. After troubleshooting a bit, I found that the first part of the
> CSS generated by pygmentize seemed different to the rest. I tried removing
> that part and the script worked fine. I guess the output from pygmentize
> might have changed recently.
There were several changes to Pygments since the last update of the
Docutils sandbox script 2013-03-27, indeed.
> What I did was:
> pygmentize -f html -S colorful >pygments-colorful.css
> and the part I had to remove from the top was something like:
> pre { line-height: 125%; }
> td.linenos .normal { color: inherit; background-color: transparent;
> padding-left: 5px; padding-right: 5px; }
> span.linenos { color: inherit; background-color: transparent; padding-left:
> 5px; padding-right: 5px; }
> td.linenos .special { color: #000000; background-color: #ffffc0;
> padding-left: 5px; padding-right: 5px; }
> span.linenos.special { color: #000000; background-color: #ffffc0;
> padding-left: 5px; padding-right: 5px; }
On my Debian/stable system, with Pygments version 2.3.1, the output of
`pygmentize -f html -S colorful` does not contain these lines this further
indicates that there was a "recent" addition.
> Maybe the script has to be adapted to filter out this portion, or to
> generate the correct output from it? I am quite ignorant in CSS and html,
> so I can't really tell what's doing.
Volunteers/patches welcome.
Thank you for reporting,
Günter
_______________________________________________
Docutils-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-users
Please use "Reply All" to reply to the list.