# How to get default formatting for \chapter, \section, etc.?

I'd like to use titlesec to make some modifications to section and chapter headings, but titleformat redefines the formatting entirely instead of just making modifications (e.g. if I just want to change the colour).

How do I get titlesec to modify instead of entirely redefine? Is this possible?

If not, how do I figure out what is the current formatting of \chapter, \section, etc. so that I can replicate it and make my modifications?

In response the request for a sample document, I guess the most basic is:

\documentclass{article}
\begin{document}
\section{Hello World}
Hello world!
\end{document}


However, I'm interested in a way to find out (e.g. to print out) the current formatting of \section instead of simply "knowing" it for a particular configuration.

• Can you give a short complete document showing your setup (like document class and style files)? What you consider as the default depends on such things. – gernot Nov 15 '16 at 15:24
• You could switch to KOMAscript (in your case \documentclass{scrartcl}) and then use the \addtokomafont{}{} command to change single attributes of the fonts of e.g. headings. – Manuel Weinkauf Nov 15 '16 at 15:32
• Check the documentation of titlesec, section 9.2. Standard Classes. – Arash Esbati Nov 15 '16 at 15:33

For simple modifications such as the title colour, you can use the light version of \titleformat, but have to check in article.cls (or report, or book) what the values of the parameters are (fontsize, weight, shape).

Here is an example:

\documentclass[a4paper]{article}
\usepackage[svgnames]{xcolor}
\usepackage{titlesec}
\titleformat*{\section}{\color{IndianRed}\normalfont\bfseries\Large}

\begin{document}

\section{A short title}
This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.

\end{document}


The standard classes are defined as follows (copied from titlesec reference, section 9.2)

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titleformat{\section}
{\normalfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
{\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
{\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}
\titleformat{\paragraph}[runin]
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titleformat{\subparagraph}[runin]
{\normalfont\normalsize\bfseries}{\thesubparagraph}{1em}{}
\titlespacing*{\chapter}     {0pt}{50pt}{40pt}
\titlespacing*{\section}     {0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\titlespacing*{\subsection}   {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titlespacing*{\subsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titlespacing*{\paragraph}   {0pt}{3.25ex plus 1ex minus .2ex}{1em}
\titlespacing*{\subparagraph} {\parindent}{3.25ex plus 1ex minus .2ex}{1em}


Try that

\documentclass{scrartcl}
\usepackage{xcolor}

• scrartcl does not know \chapter. Using the KOMA-Script command \RedeclareSectionCommand it is also possible to modify attributes like beforeskip, afterskip, indent. The default settings for these attributes can be found in the KOMA-Script documentation. – esdd Nov 15 '16 at 15:53