
I would like to add a colored box around the chapter number and section number, I want to get the same style as the photo attached but I don't know how to do this. I appreciate if someone can help me.
I'm using texshop.
\chapterformat
, e.g., using \renewcommand*{\chapterformat}{\colorbox{red}{\textcolor{white}{\thechapter}}\enskip}
. There are also commands for other section levels and \chapterlinesformat
and \sectionlinesformat
for advanced changes. See the manual and several examples in the internet for more information. memoir also has its own commands so configure the chapter title. See the manual for more information. Other classes may also have similar features (again, see the manual) or allow to use titlesec.