Converting a pygments CSS stylesheet to latex
Jorge Scandaliaris <[email protected]> Tue, 15 Jun 2021 21:54:09 -0300
| Newsgroups | gmane.text.docutils.user |
|---|---|
| Message-ID | <CA+=MJbWjb6=mZriFbTppsqu+r-5N-w99BZ4ZtPLQfAMwYLWO_w@mail.gmail.com> |
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.
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.
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; }
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.
Regards,
Jorge Scandaliaris