2

I'm trying to give to the subsection title an italic style, but I don't want that this style is applied also to the subsection number. Is it possible?

I'm trying in this way:

\documentclass{book}
\usepackage{titlesec}
\titleformat*{\subsection}{\normalsize\itshape}
\begin{document}

\tableofcontents

\chapter{Test}
\section{Test2}
\subsection{Test3}

\end{document}

but what I have is this:

enter image description here

As you can see also "1.1.1" is italic.

1

The unstarred version of \titleformat has more options, and can do what you want:

\titleformat{\subsection}{\normalsize\itshape}{\upshape\thetitle\quad}{}{}

Here the \upshape\thetitle\quad part changes the font back to upright for the number only.

If you define multiple section types (i.e. also subsubsection) to have italic titles, it may be easier to specify that all ((sub)sub)sections should have their numbering upright with the following:

\titlelabel{\upshape\thetitle\quad}
  • You shouldn't add \quad to the second mandatory argument, but set the third argument to 1em. – Bernard May 18 '17 at 20:52
1
\documentclass{book}
\usepackage{titlesec}
\titleformat{\subsection}[hang]{\normalsize\itshape}{\textup{\thesubsection}}{1em}{}[]
\begin{document}

\tableofcontents

\chapter{Test}
\section{Test2}
\subsection{Test3}

\end{document}

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.