\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)

\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}


See §2.3 of the tocloft manual for more details.

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}


• 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
• 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
• @Davislor Don't worry about that, your answer is obviously better. – Amita Jul 18 '20 at 23:10
• 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