Setting section color in local layout

Richard Kimberly Heck rikiheck at gmail.com
Wed Jan 4 22:50:26 UTC 2023


On 1/4/23 16:37, Lorenzo Bertini wrote:
> Il 04/01/23 22:06, Ricardo Berlasso ha scritto:
>>
>> El mié, 4 ene 2023 a las 21:41, Lorenzo Bertini 
>> (<lorenzobertini97 at gmail.com <mailto:lorenzobertini97 at gmail.com>>) 
>> escribió:
>>
>>     Hi,
>>
>>     setting the following in local layout
>>
>>      > Style Section
>>      >       Font
>>      >               Color           Pink
>>      >       EndFont
>>      > End
>>
>>     makes Lyx's workarea sections pink indeed (it's just a test color, I
>>     swear it's temporary :)), so Lyx is reading the layout alright. But
>>     if I
>>     output the document, both with Latex and LyXHTML, section labels are
>>     black. Could someone tell me what I'm doing wrong?
>>
>>
>> In fact, the Font block on the local layout only affect the editing 
>> area. If you want to change the actual heading formatting you need to 
>> use the titlesec package. For example, to set the section heading to 
>> use the sans font defined in the document (\sffamily), in bold and 
>> with its size set as \Large, assigning to it a custom color (I don't 
>> like pink), write in the document preamble,
>>
>> \usepackage{titlesec}
>> \usepackage{xcolor}
>> \definecolor{Greeeeen}{rgb}{.3,.7,.3}
>> \titleformat*{\section}{
>>        \Large\bfseries\sffamily
>>        \color{Greeeeen}}
>>
>> [[   BTW, I talk about those things in chapter 12 here: 
>> https://frommindtotype.wordpress.com/lyx-book/ 
>> <https://frommindtotype.wordpress.com/lyx-book/>   ;) ]]
>>
>> Regards,
>> Ricardo
>
> Thank you, I was aware of the titlesec package, but using mainly 
> LyXHTML I was looking into something less specific to output method. 
> In the Font block however, the Size parameter does affect output, at 
> least in the LyXHTML case.
>
> Why this inconsistency? Should I ask lyx-devel about possibly 
> implementing color from layout (titlesec for Latex and CSS for LyXHTML)?

That's a missing feature then. We do handle some font features, but not 
all of them. (We would only do this for LyXHTML. The font color in LyX 
itself is not meant to be reflected in LaTeX, unless you specify that 
separately, as above.)

The easiest way to solve this for now would be to add some CSS to the 
layout.

Riki




More information about the lyx-users mailing list