Graphics, Figures & TablesHow to make \tableofcontents not show word Contents and how to introduce more dots

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
lukaszskowron96
Posts: 36
Joined: Tue Oct 09, 2018 1:01 pm

How to make \tableofcontents not show word Contents and how to introduce more dots

Post by lukaszskowron96 »

Hi,

So as I said in the title that's what I want to achieve. To better explain what I want to do, here's a picture:

Image

I added the extra "contents" below the one I want to delete using:

Code: Select all

\addcontentsline{toc}{section}{Contents}


and now I have awkward two "contents" and that's why I want to delete the upper one.

By the way, I also want to have dots after "Contents" and after "1 Introduction", how can I do it?

I tried using tocloft package but it not necessarily works well with article class document and can't get it to work, any other propositions?

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

Stefan Kottwitz
Site Admin
Posts: 10334
Joined: Mon Mar 10, 2008 9:44 pm

How to make \tableofcontents not show word Contents and how to introduce more dots

Post by Stefan Kottwitz »

Hi,

by the way, one can get a faster answer if actual code is posted that I just need to modify a bit.

Now I wrote this code myself, and here you can see what you can change:

Code: Select all

\documentclass[toc=sectionentrywithdots]{scrartcl}
\begin{document}
\addcontentsline{toc}{section}{Contents}
\makeatletter
\@starttoc{toc}
\makeatother
\clearpage
\section{Introduction}
\subsection{Introduction}
\end{document}

Stefan
LaTeX.org admin
lukaszskowron96
Posts: 36
Joined: Tue Oct 09, 2018 1:01 pm

How to make \tableofcontents not show word Contents and how to introduce more dots

Post by lukaszskowron96 »

OK, it works, but I am not sure why you changed the document class. What is the difference between this you used and article?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10334
Joined: Mon Mar 10, 2008 9:44 pm

How to make \tableofcontents not show word Contents and how to introduce more dots

Post by Stefan Kottwitz »

In this topic, there was no document class mentioned. So I chose just any one. And I chose scrartcl because I saw your header is in sans serif font, that's scrartcl style (KOMA-Script) but not article default style. I just had to guess.

Stefan
LaTeX.org admin
lukaszskowron96
Posts: 36
Joined: Tue Oct 09, 2018 1:01 pm

How to make \tableofcontents not show word Contents and how to introduce more dots

Post by lukaszskowron96 »

Actually when I change the document class to article the extra dots disappear. Any idea why? I mean I see no difference between scrartcl and article so I can keep the scrartcl.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10334
Joined: Mon Mar 10, 2008 9:44 pm

How to make \tableofcontents not show word Contents and how to introduce more dots

Post by Stefan Kottwitz »

Yes, keep scrartcl, that's much more modern and offers a lot of options for customization.

Stefan
LaTeX.org admin
Post Reply