Text FormattingHow to control the text format in table of content

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
gwada74
Posts: 42
Joined: Fri Nov 26, 2010 5:28 pm

How to control the text format in table of content

Post by gwada74 »

Hi,
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 ?
Last edited by gwada74 on Sat Mar 19, 2011 3:33 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

How to control the text format in table of content

Post by localghost »

Use the tocloft package. Examples of application can be found via forum search.


Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
gwada74
Posts: 42
Joined: Fri Nov 26, 2010 5:28 pm

How to control the text format in table of content

Post by gwada74 »

Sorry about this simple question; I've found the solution :

Code: Select all

subsection\[textit{title}]{title}
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

How to control the text format in table of content

Post by localghost »

gwada74 wrote:[…] I've found the solution :

Code: Select all

subsection\[textit{title}]{title}
That's far from being recommendable. Furthermore it won't work because it is syntactically wrong. The tocloft way is the better one.

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}
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
Post Reply