Text Formatting ⇒ How to control the text format in table of content
How to control the text format in table of content
I am using the class book. My book has a table of content in 3 Depth : Chapter, section and subsection.
My editor is asking me to get the subsection in italic in the table of content. How can I do this ?
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How to control the text format in table of content
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
How to control the text format in table of content
Code: Select all
subsection\[textit{title}]{title}- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How to control the text format in table of content
That's far from being recommendable. Furthermore it won't work because it is syntactically wrong. The tocloft way is the better one.gwada74 wrote:[…] I've found the solution :Code: Select all
subsection\[textit{title}]{title}
Code: Select all
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{tocloft}
\usepackage{blindtext}
\renewcommand{\cftsubsecfont}{\itshape}
\renewcommand{\cftsubsecpagefont}{\itshape}
\begin{document}
\tableofcontents
\medskip
\blinddocument
\end{document}Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10