emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: equal syntax highlighting for publishing code blocks to html and pdf


From: Norman Tovey-Walsh
Subject: Re: equal syntax highlighting for publishing code blocks to html and pdf
Date: Sat, 01 Feb 2020 08:53:20 -0600
User-agent: mu4e 1.3.6; emacs 26.3

Bastien writes:
>> Frequently I publish org-mode documents containing source code blocks
>> to html (htmlize) and pdf (minted). I would like to see the same
>> colors in both export types. But
>> I cannot figure out, what’s the best way to achieve this.
>>
>> Has anyone solved this problem? Are there any hints?

On casual inspection, HTML export seems to derive the colors from the
way Emacs has fontified the buffer. It appears to insert the colors
literally, which I guess it has to if it’s going to base them on face
properties.

> If you find a solution, please mention it here, others may be
> interested.

I think there are two plausible ways forward. If you like the colors
used by minted, you can try changing the faces in Emacs to match them.
If you like the colors used by Emacs, you can change the colors used by
minted to match. Minted appears to use pygments, so you could create
your own style[1] and then use that style in your documents[2].

My own approach to printed output[3] doesn’t use minted yet, so I
haven’t actually tried to do any of these things :-)


                                        Be seeing you,
                                          norm

[1] https://pygments.org/docs/styles/
[2] https://tex.stackexchange.com/questions/218556/style-pygments-at-pythontex
[3] https://so.nwalsh.com/2020/01/05-latex

--
Norman Tovey-Walsh <address@hidden> | The fact that an opinion has been
https://nwalsh.com/                 | widely held is no evidence
                                    | whatever that it is not utterly
                                    | absurd; indeed in view of the
                                    | silliness of the majority of
                                    | mankind, a widespread belief is
                                    | more likely to be foolish than
                                    | sensible.--Bertrand Russell

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]