I know there are \color and \textcolor commands for changing colors in mathmode. However, these commands have two arguments, so when I enter them in LyX, the first argument "swallows" the command and I can't enter the text whose color I want to change.

How do I change color in mathmode within LyX?

  • 2
    \color only has one argument. – Torbjørn T. Dec 5 '15 at 14:26
  • Can you please make a bug report at lyx.org/trac ? I know it takes time, but it would be appreciated if you took the time to help make LyX better. – scottkosty Dec 5 '15 at 17:37
  • I think this was previously reported as: lyx.org/trac/ticket/5269 – scottkosty Dec 5 '15 at 19:19

can also be used inside the math mode.

enter image description here

  • 1
    Note that this works for LyX if you paste it in all at once. Specifically, copy the LaTeX, start a math inset, paste. – scottkosty Dec 5 '15 at 17:36
  • @scottkosty is correct. Instead of copying and pasting each time, I copy and paste \textcolor{#1}{#2} once into a macro with two arguments. If you only need red, make a one argument macro and paste in \textcolor{red}{#1}. – webelo Aug 22 '16 at 21:11

I'm not sure about LyX, but in LaTeX, adding colors in math expressions does work the same way it does in normal text, for example:

\( {\color{red} \frac{1}{4}} + {\color{blue} \frac{2}{4}} = {\color{green} \frac{3}{4}} \)



Might not work in LyX though.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.