emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Norman Tovey-Walsh <ndw@nwalsh.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: equal syntax highlighting for publishing code blocks to html and pdf
Date: Sat, 01 Feb 2020 08:53:20 -0600	[thread overview]
Message-ID: <m2a762uzof.fsf@nwalsh.com> (raw)
In-Reply-To: <87imkqodw3.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1945 bytes --]

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 <ndw@nwalsh.com> | 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

      parent reply	other threads:[~2020-02-01 14:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-26 18:34 equal syntax highlighting for publishing code blocks to html and pdf Johannes Brauer
     [not found] ` <gtgq2ENI7XZ0oW25n6FBp-9xejE6p6qXvCyA4q6yI2vq4UjIAPMo3ZkKPYZv6_Ne8HmjbWBRGayPrX7D7CVUFA==@protonmail.internalid>
2020-02-01  9:28 ` Bastien
2020-02-01 13:50   ` John Kitchin
2020-02-29 10:55     ` Johannes Brauer
2020-02-01 14:53   ` Norman Tovey-Walsh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2a762uzof.fsf@nwalsh.com \
    --to=ndw@nwalsh.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).