[Tex/LaTex] determine the exact size and position of titles with the titlesec package

titlesec

I need 11pt titles and don't know what to do, 'medium' seems quite vague.
This is my code:

\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\Medium\upfamily\centering}
{\chaptertitlename\ \thechapter}{0pt}{\Medium}

Best Answer

The medium in titlesec is a package option, not a command. So it is accessed by \usepackage[medium]{titlesec}. If you need all section titles to be 11pt, and your document text is also 11pt, the use \usepackage[tiny]{titlesec} which makes all headings (except chapters) to be the text font size.

To make chapter headings the same size as the main document font size, you can use \normalfont in the chapter title definition.

Here's a small document that shows both patterns. I've added the \fontsize macro from What point (pt) font size are \Large etc.? to show the actual size.

The tiny option sets all section and lower headings to the same size as the font size. It doesn't change chapter headings and you say you want them centred so I have given an example of how to do that.

To adjust the chapter spacing you need to supply values for the \titlespacing command. To set the titles immediately above the following text you can set the spacing to 0pt. using \titlespacing*{\chapter}{0pt}{0pt}{0pt}.

\documentclass[11pt]{report}
\usepackage[tiny]{titlesec}
\titleformat{\chapter}[display]%
     {\normalfont\bfseries\fillast}
     {\chaptertitlename\ \thechapter}
     {0pt}{}
\titlespacing*{\chapter}{0pt}{0pt}{0pt}
\makeatletter
\newcommand\thefontsize[1]{{#1 \f@size pt\par}}
\makeatother
\begin{document}
\chapter{\thefontsize{This is a chapter }}
Some text.
\section{\thefontsize{This is a section}}
\subsection{\thefontsize{This is a subsection}}
\end{document}

output of code

Related Question