2

I'm writing a book chapter and the editor has some specific formatting requirements. In particular, he wants the section titles to be centered and not bold. I'm using titlesec with:

\titleformat{\section}
  {\normalfont\fontfamily{cm}\fontsize{16}{19}\selectfont}{\thesection}{1em}{}

This ensures the section title is not bold. To make it centered, I did:

\titleformat{\section}
  \centering{{\normalfont\fontfamily{cm}\fontsize{16}{19}\selectfont}{\thesection}}{1em}{}

However, this somehow ignores the fontsize, resulting in a unbolded, centered, but small font sized section title. How can I ensure the fontsize is larger, as indicated in the command?

  • The syntax in the second code is wrong, as \centering should go after the opening brace and not before; also cmr is the family name, but you don't need it. – egreg Jun 29 '14 at 13:54
3

Your syntax is wrong; here is a more correct one. The arguments to \titleformat needn't be specified in this format, but this I find it more readable to keep each one in a separate line.

\documentclass{book}
\usepackage{lmodern}
\usepackage{titlesec}

\titleformat{\section}
 {\centering\normalfont\fontsize{16}{19}\selectfont}
 {\thesection}
 {1em}
 {}

\begin{document}
\chapter{First}
\section{A title}
\end{document}

I added \usepackage{lmodern} in order to have arbitrarily scalable fonts. Note that giving \fontfamily is redundant, because \normalfont already sets the default font family.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.