How to pass a color value as a macro? (Doesn't seem to work.)

11 views
Skip to first unread message

Victor S.

unread,
Oct 14, 2022, 12:45:03 PM10/14/22
to MathJax Users
I'm trying to define a macro, \someColor, that would hold a color value, then pass it to \color as \color{\someColor}, but I can't. Any help appreciated.

\(
\def\someColorA{##ff0000}
\def\someColorB{\#0000ff}
\begin{gather}
{\color{\someColorA}\text{hello A}}\\
{\color{\someColorB}\text{hello B}}\\
{\color{#00ff00}\text{hello}}\\
\end{gather}
\)


Neither text (A or B) is properly colored.


Thank you

Davide Cervone

unread,
Dec 9, 2022, 2:58:35 PM12/9/22
to mathja...@googlegroups.com
The \color command does not process macros within its argument, so MathJax does not support the functionality you are looking for.  You could do 

\def\ColorA{\color{#ff0000}}

and then use

{\ColorA \text{hello A}}

but that isn't exactly what you are looking for, and you probably already thought of that.

Davide


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/de46606e-83ad-4cbe-aeff-6f5708a7eafdn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages