Page LayoutChapter and section style in latex thesis

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Raly
Posts: 2
Joined: Wed Nov 18, 2020 10:48 pm

Chapter and section style in latex thesis

Post by Raly »

I'm new in the latex community and actually I don't know if I'm posting my question in the right place :?
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.
Attachments
photo.png
photo.png (64.17 KiB) Viewed 4958 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Chapter and section style in latex thesis

Post by Ijon Tichy »

This depends on the class you are using and if you are using a package for the chapter/section titles like titlesec also on that package. So without Infominimal working example I can only gamble and give some general information: With the standard classes book and report you need an extra package. See e.g. the already linked titlesec. With a KOMA-Script class you can change the chapter number format redefining \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.

Note, a more detailed answer needs a lot of more information in the question, not only a Infominimal working example but, e.g., also information on how the formatting of chapter/section titles with more than one line can should be.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Raly
Posts: 2
Joined: Wed Nov 18, 2020 10:48 pm

Chapter and section style in latex thesis

Post by Raly »

Thanks for your replay.
I prepared an example of what I'm using, I'm using the titlesec package
I attached an example file.

\documentclass[a4paper,11pt,twoside,english]{book}
\usepackage[a4paper,top=2.5cm,bottom=2.5cm,left=3cm,right=2.5cm]{geometry}
\linespread{1.3}

\usepackage{titlesec}
\usepackage[Glenn]{fncychap}

\begin{document}
\include{SM_new}
\end{document}

Now, I tried to use what you suggested

\renewcommand*{\chapterformat}{\colorbox{red}{\textcolor{white}{\thechapter}}\enskip}

but it give error that \chapterformat not defined.

should I include any package before using renew command ?

Thanks in advanced.
Attachments
SM_new.tex
(124 Bytes) Downloaded 275 times
Thesise.tex
(342 Bytes) Downloaded 235 times
Post Reply