Text FormattingTable of Contents

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ekmandyn
Posts: 1
Joined: Fri Oct 14, 2011 10:52 pm

Table of Contents

Post by ekmandyn »

I've been trying to get the entire table of content in upper case

i.e,
1. CHAPTER
1.1 SECTION
1.1.1 SUBSECTION

instead of
1. CHAPTER
1.1 Section
1.1.1 Subsection

does anybody have some idea how to do this?
Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Table of Contents

Post by localghost »

I can offer a solution by the titletoc package.

Code: Select all

\documentclass[11pt,english]{report}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{titletoc}
\usepackage{blindtext}

\titlecontents{chapter}[1.8em]{}{\bfseries\contentslabel{1.5em}\MakeUppercase}{\hspace*{-1.5em}}{\bfseries\titlerule*{}\contentspage}
\titlecontents{section}[4.1em]{}{\contentslabel{2.3em}\MakeUppercase}{\hspace*{-2.3em}}{\titlerule*[8pt]{.}\contentspage}
\titlecontents{subsection}[6.4em]{}{\contentslabel{2.3em}\MakeUppercase}{\hspace*{-2.3em}}{\titlerule*[8pt]{.}\contentspage}

\begin{document}
  \tableofcontents

  \blinddocument
\end{document}
The packages babel (with its global language option »english«) and blindtext have only been used to create dummy text, thus are not part of the solution.


Best regards and welcome to the board
Thorsten
hasnun
Posts: 2
Joined: Wed Aug 10, 2016 10:17 am

Re: Table of Contents

Post by hasnun »

I'm searching for the way to have different styles between numbered chapter (\chapter) and unnumbered chapter (\chapter*) using \titlecontents.

I would like to have different spacings between these two in my TOC. And also, the numbered chapter should not have page number, only appear in the TOC, but the unnumbered chapter should have the page number.

Any idea?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Table of Contents

Post by Stefan Kottwitz »

Hi Hasnun,

welcome to the forum!

The titletoc manual says: "Using sectioning commands in the starred version is strongly discouraged." It provides an alternative solution in 4.2. Starred Versions.

Btw. please open a new topic for your own question, don't attach to a very old topic.

Stefan
LaTeX.org admin
hasnun
Posts: 2
Joined: Wed Aug 10, 2016 10:17 am

Re: Table of Contents

Post by hasnun »

Dear Stefan,

thanks for the reply. My temporary solution was to edit the TOC manually and call it manually using \input <filename>.toc instead of \tableofcontents

I am sorry for not creating a new topic.
Post Reply