0
\documentclass{article}
\usepackage{tocloft}

\begin{document}
\tableofcontents

\section{Section title}
Section text

\subsection{Subsection title}
Subsection text

\end{document}

How can I italicize the font of "Subsection title" in the table of contents? (not in the document body)

4
\documentclass{article}
\usepackage{tocloft}

\renewcommand{\cftsubsecfont}{\itshape}
\renewcommand{\cftsubsecpresnum}{\upshape}

\begin{document}
\tableofcontents

\section{Section title}
Section text

\subsection{Subsection title}
Subsection text

\end{document}

tocloft sample

See §2.3 of the tocloft manual for more details.

4

You can remodify the definition of the command \cftsubsecfont which controls the output of subsection title

\documentclass{article}

\usepackage{tocloft}
\renewcommand{\cftsubsecfont}{\itshape}

\begin{document}
\tableofcontents

\section{Section title}
Section text

\subsection{Subsection title}
Subsection text

\end{document}

enter image description here

4
  • 1
    You beat me to it by one minute, because I also set the subsection number upright and linked to the manual. – Davislor Jul 18 '20 at 21:41
  • 1
    I hope my first comment didn’t sound too whiny. It’s a good answer, and I upvoted it! – Davislor Jul 18 '20 at 22:50
  • 2
    @Davislor Don't worry about that, your answer is obviously better. – Amita Jul 18 '20 at 23:10
  • 1
    Very kind of you to say. If I’d seen yours first, I’d have made my own additions as comments. – Davislor Jul 19 '20 at 1:17

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.