texmath icon indicating copy to clipboard operation
texmath copied to clipboard

Feature request: color

Open corcoted opened this issue 2 years ago • 3 comments

It would be nice to be able to convert color attributes.

For example, from MathML

<math>
    <mi style="color: blue">m</mi>
    <mi>x</mi>
    <mo>+</mo>
    <mi style="color: red">c</mi>
</math>

to/from LaTeX (assuming the color or xcolor package is loaded...)

$$ {\color{blue}m}x+{\color{red}c} $$

which renders as

$$ {\color{blue}m}x+{\color{red}c} $$

Alternatively, (although MathJAX doesn't support this)

$$ \textcolor{blue}{m}x+\textcolor{red}{c} $$

corcoted avatar Aug 25 '23 21:08 corcoted

+1; c.f. https://github.com/jgm/pandoc/issues/10222

d-morrison avatar Sep 27 '24 18:09 d-morrison

Looks like in OMML color is added this way:

<m:r><w:rPr><w:color w:val="FF0000" w:themeColor="accent4"/></w:rPr><m:t>y</m:t></m:r>

(for red)

jgm avatar Sep 28 '24 18:09 jgm

I added a branch color with a bit of work towards this.

One issue is how to store the colors. If we use strings, we'll need to convert them to RGB values for some formats. If we use RGB values, we'll need strings for some formats.

jgm avatar Sep 28 '24 19:09 jgm