[Tex/LaTex] Color text in LyX

colorformattinglyx

I'm trying to color specific text in LyX, wondering how to do that with the graphical user interface (shortcut or something of sorts).

Best Answer

Select the text you wish to change the colour of, right click on it, and choose Text style --> Customized. Here you can choose among other things the colour. See screenshots at the bottom.

Should you wish to use other colours, you can redefine the existing colours, by adding some code to the preamble. Go to Document --> Settings --> laTeX Preamble, and add for instance

\definecolor{green}{RGB}{0, 180, 0}

to change the colour called "green" in the text style dialogue. You cannot add new colour names to the GUI, see http://wiki.lyx.org/Tips/Color

Should you want other colours, you would have to use LaTeX code. Load the xcolor package by adding \usepackage{xcolor} to the preamble, add a code box in the text, by hitting Ctrl + L, and write \textcolor{<colourname>}{This is in colour.}. <colourname> can be a colour you have defined yourself using the syntax mentioned above, or one of colours defined by xcolor – see the xcolor manual.

enter image description here enter image description here

enter image description here