colors in environments

Herbert Voss Herbert.Voss at fu-berlin.de
Tue Aug 6 19:01:46 UTC 2024



Am 06.08.24 um 17:06 schrieb Richard Kimberly Heck:
> On 8/6/24 8:56 AM, Sergio Celani wrote:
>>   Hello
>>
>> I need to modify or create a new module so that the environments 
>> 'theorem', 'lemma', 'proposition', etc., appear in a different color. 
>> For example, I'd like to modify the 'theorems-ams.module' file so 
>> that the colors of the environments change in the generated LaTeX 
>> file. I only want to change the color of the label and number, not 
>> the content. Is there an easy way to do this?

If you do not need the color inside LyX z´then you need
only these commands in the preamble (here only shown for Lemma):

\usepackage{xcolor}

\AtBeginDocument{%

\renewcommand\lemmaname{\textcolor{red}{\bfseries\Large Lemma}}%

\renewcommand\thethm{\textcolor{red}{\bfseries\Large\arabic{thm}}}%

}

If you want it also inside LyX, then create a new layout file
and set the color, e.g. for Lemma in theorems-ams.inc

Style Lemma
     CopyStyle             Theorem
     DependsOn             Theorem
     LatexName             lem
     LabelString           "Lemma \thetheorem"
     LabelFont
       color    red
     endFont
    ...


Attached the LyX view and pdf output for the amsarticle class.

Herbert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bildschirmfoto 2024-08-06 um 20.55.19.png
Type: image/png
Size: 135071 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20240806/d2fb05b0/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bildschirmfoto 2024-08-06 um 20.55.42.png
Type: image/png
Size: 26071 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20240806/d2fb05b0/attachment-0003.png>


More information about the lyx-users mailing list