Page LayoutToc - add text to the table of contents

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
User avatar
Zetison
Posts: 17
Joined: Fri Dec 02, 2011 2:05 pm

Toc - add text to the table of contents

Post by Zetison »

I want to make a table of contents which is similar to the one on this page: https://wiki.math.ntnu.no/users/ehrnstr ... earmethods.

So when I write

Code: Select all

\section{Sets}
I want the toc to include the text as if I was writing

Code: Select all

\section{Sets: Basic definition and examples}
But I obviously don't want the text ": Basic definition and examples" to appear as a section title in the document. Can this be done?

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

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Toc - add text to the table of contents

Post by Johannes_B »

You could do something like this.

Code: Select all

\documentclass[12pt]{article}
\begin{document}
\tableofcontents
\section[Sets: Basic definition and examples]{Sets}
\end{document}
If this is a good choice is not my decision. I don't see any drwbacks in this right now, but there might be some.

Best regards
Johannes

PS: Please read about Minimal working examples.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply