# Is it possible to define RGB colors to be used in MaTeX? How?

My system: Windows 10, Mathematica 11.2, MikTeX 2.9

I am in the process of learning more about the features of Szabolcs Horvát's nice paclet. This time I am toying with the color choices for the produced text. I have this (questionably) bright idea to match the colors of components of a figure with the accompanying MaTeX-outputs. Unfortunately the sets of available colors don't quite match.

After the start

In[1]:=<< MaTeX
In[2]:=SetOptions[MaTeX, "Preamble" -> {"\\usepackage{color}"}]


many things work splendidly. But the input

In[3]:=Graphics[Text[MaTeX["\\color{orange}{\\bf{x}^\\perp}", FontSize -> 16], {2, 1.3}]];


gives the error message saying that the color orange is not defined. Hardly a surprise given that a bit of digging reveals that orange is not available in the prescribed LaTeX-package.

If I were writing either LaTeX or Mathematica code I would know what to do. In Mathematica I would use RGBColor with appropriate parameters. In LaTeX I would try something like \definecolor{grey}{rgb}{0.8, 0.8, 0.8} to define a color in a macro.

How can I do this with MaTeX?

• load a different TeX-package, which?
• define the desired color by inserting a macro, how?

I was at my dullest. Or, if not that, mostly oblivious to what the In[2] command in the snippet from the question body does.

Apparently it is possible to pass several LaTeX-commands within the preamble. A bit of testing shows that

   In[2]:=SetOptions[MaTeX,
"Preamble" -> {"\\usepackage{color}",
"\\definecolor{orange}{rgb}{1,0.6,0}"}]


does exactly what you might wistfully hope it would :-)

• Also magenta may be more distinguishable from red than orange, and hence a better choice. – Jyrki Lahtonen Jan 22 at 6:46
• Mathematica also uses the range $[0, 1]$ in RGBColor`, as well as most other constructs. – Szabolcs Jan 22 at 10:31
• Thanks for the correction @Szabolcs. I wonder how I got that wrong impression. I do remember from VGA-programming back in the day that then a palette definition used bytes (possible with smaller number of bits per component). May be that was explained in Wolfram documentation, I didn't read carefully, and jumped to a conclusion? – Jyrki Lahtonen Jan 22 at 11:09