17

I am using example given here by @stephan TOC Section & Subsection coloring. Works great however I want to get rid of dots and page numbers.

I added this to the preamble

\let\Contentsline\contentsline 
\renewcommand\contentsline[3]{\Contentsline{#1}{#2}{}}

that removed the page numbers, but do not know how to remove the dots. I would appreciate your help. Its hard to get result without understanding the basics.

1 Answer 1

24

Method - 1: Add

\makeatletter
\renewcommand{\@dotsep}{10000} 
\makeatother

in your preamble.

Method - 2: This can be achieved by tocloft package also. Here one has to use

\addtocontents{toc}{\cftpagenumbersoff{chapter}}

to remove the page numbers and

\renewcommand{\cftdot}{}

to remove the dots.

A MWE will be:

\documentclass{article}
\usepackage{tocloft}
% \cftpagenumbersoff{chapters}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\addtocontents{toc}{\cftpagenumbersoff{section}} %% Similarly for subsection, figure... as you wish
\renewcommand{\cftdot}{} %empty {} for no dots. you can have any symbol inside. For example put {\ensuremath{\ast}} and see what happens.
% ----------------------------------------------------------------
\begin{document}


\tableofcontents

\chapter{one}

\section{one}

\end{document}
2
  • method-1 worked great, thanks for your help.
    – Raama
    Commented May 12, 2012 at 10:50
  • method 2- does not work on \listofalgorithms, but method 1 works... thanks!
    – ultrajohn
    Commented May 8, 2013 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .