I am using LyX 2.0.5 with document class article
and 'Theorems (AMS)' in the modules. I am wondering if it is possible to make it so that the titles of different environments will be highlighted in different colors ("highlighted" in the sense of a highlight marker. I.e., having a colored background, w/o changing the font color). E.g., in the Theorem
environment the words Theorem 12.1 will be typeset with red highlight, in the Definition
environment the words Definition 5.9 will be typeset with yellow highlight, etc.
I am guessing the will require changing the module?
Best Answer
(Note: there are parts of this solution that are sub-optimal, and I'm aware of that, but I'll have to fix that later. I'll remove this note when I find the time to improve things.)
You can change the files
theorems-ams.module
andtheorems-ams.inc
, or better create copies as described in my answer to How to make "claim" environments look like "theorem" environment?In
theorems-ams.module
, addxcolor
to the required packages. I.e. where it saysedit this to
(This bit is untested, but I assume it will work.)
In
theorems-ams.inc
, find the style you want to change, for example the block defining the look of theorems starts withStyle Theorem
.In the
Style
block there is a sub blockPreamble
, which by default looks likeUsing code taken from egreg's answer to amsthm environment and colorbox, edit this to read
Note that this will not change the view in LyX, only in the PDF. Do similarly for
Definition
, but use a different name for the\newtheoremstyle
. The background colour is set by the first argument to\colorbox
, herered
.For a single document, you could use the Local layout under Documents --> Settings. Add the entire
Style
block to the local layout. You may need to also include\usepackage{xcolor}
to thePreamble
block.