Setting section color in local layout

Lorenzo Bertini lorenzobertini97 at gmail.com
Wed Jan 4 21:37:37 UTC 2023


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)?

-- 
Lorenzo


More information about the lyx-users mailing list