Defining sectioning styles
A section in a document usually consists of a chapter title as well as first, second and third level headings. The titlesec
package is used for this and then you define how each of the headings are formatted.
Note: For some of the long commands, I added line breaks for readability. You need to remove those breaks when using the syntax.
Using the titlesec package
To set sectioning styles and packages, you can use the titlesec
package. titlesec
provides an interface for defining various title styles.
\usepackage{titlesec}
Defining chapter titles
I configured the chapter title to have a 19pt font size.
\titleformat{\chapter}{\fontsize{19pt}{0em}\selectfont\bf}{\thechapter.}{1em}{}
To remove the large space above the chapter title:
\titlespacing*{\chapter}{0pt}{-30pt}{20pt}
To indent the section label:
\titlelabel{\llap{\makebox[1cm][l]{\thetitle}}\hspace*{25.4mm}}
To set the size and position of the chapter heading:
\titleformat{\chapter}{\fontsize{20pt}{0em}
\selectfont\bf\color{namecolor}}{\thechapter.}{1em}{}
Defining section headings
To set the size and position of the section headings:
\titleformat{\section}[hang]
{\normalfont\Large\bfseries\color{namecolor}}
{\thesection.}
{1em}{}
\titlespacing{\section}{0pt}{*4}{*1\.5}
For subsection headings:
\titleformat{\subsection}[hang]
{\normalfont\Normalsize\bfseries\color{namecolor}}
{\thesubsection.}{1em}{}
For subsubsection headings:
\titleformat{\subsubsection}[hang]
{\normalfont\Normalsize\bfseries\color{namecolor}}
{\thesubsubsection.}{1em}{}