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

2020-02-29 Thread Johannes Brauer
In the meantime I figure out these two options, too. But I decided the effort 
seems to high for me. Especially as emacs an minted use different syntactic 
categories.

Johannes

Am 01.02.2020 um 14:50 schrieb John Kitchin 
mailto:jkitc...@andrew.cmu.edu>>:

My guess is you have two options:

1. Customize the colors in minted to match what is on your screen. I am pretty 
sure that code in html looks very much like what is on your screen. This might 
be an entry point to customizing minted style. 
https://tex.stackexchange.com/questions/131456/customize-comment-color-in-minted-style

2. Customize the faces emacs uses for syntax highlighting to match the look in 
minted.

either way, I don't see a simple way to have a common theme between them, and 
they will probably always have some minor differences. It might be easier to 
hack a new exporter for src blocks that turns the htmlized code into latex 
markup perhaps.

John

---
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Sat, Feb 1, 2020 at 4:28 AM Bastien mailto:b...@gnu.org>> 
wrote:
Hi Johannes,

Johannes Brauer mailto:bra...@nordakademie.de>> 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?

I don't know how to do this and I guess it's difficult.

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

Thanks!

--
 Bastien




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

2020-02-01 Thread Norman Tovey-Walsh
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  | 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


signature.asc
Description: PGP signature


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

2020-02-01 Thread John Kitchin
My guess is you have two options:

1. Customize the colors in minted to match what is on your screen. I am
pretty sure that code in html looks very much like what is on your screen.
This might be an entry point to customizing minted style.
https://tex.stackexchange.com/questions/131456/customize-comment-color-in-minted-style

2. Customize the faces emacs uses for syntax highlighting to match the look
in minted.

either way, I don't see a simple way to have a common theme between them,
and they will probably always have some minor differences. It might be
easier to hack a new exporter for src blocks that turns the htmlized code
into latex markup perhaps.

John

---
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Sat, Feb 1, 2020 at 4:28 AM Bastien  wrote:

> Hi Johannes,
>
> Johannes Brauer  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?
>
> I don't know how to do this and I guess it's difficult.
>
> If you find a solution, please mention it here, others may be
> interested.
>
> Thanks!
>
> --
>  Bastien
>
>


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

2020-02-01 Thread Bastien
Hi Johannes,

Johannes Brauer  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?

I don't know how to do this and I guess it's difficult.

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

Thanks!

-- 
 Bastien