[Tex/LaTex] LyX: How to change color of an individual Shaded Background Box

boxescolorlyx

I can change it globally by going to Document -> Settings -> Colors: Shaded boxes.

However, what if I want different boxes to have different colors?

For example, in my case, by default I set the color of shaded background boxes to be yellow. But there are occasionally some boxes that I want to be light green or light blue. How do I do this?

Best Answer

The command \definecolor{shadecolor}{rgb}{0, 0, 1} issued in a TeX inset (Ctrl+L) before the shaded box will change this color to blue. If the change should be only local for that particular box, do Ctrl+L; {; exit the TeX inset; Ctrl+L again; \definecolor{shadecolor}{rgb}{0, 0, 1}; exit the TeX inset; insert your box; Ctrl+L; } I do not understand why LyX puts the environment \begin{shaded} \end{shaded} of framed.sty inside of a minipage, as the environment was meant to spill freely across the pages.

You could just as easy insert another kind of box, say a frameless one, and change its background color with a right click.

EDIT: OK, you can choose the 'inner box' to be None, and the environment will go across the pages.

Pictures added to illustrate:

In LyX

enter image description here

PDF output of above LyX file:

enter image description here