# Remove section number ToC entries with tocloft

I have formatted a ToC with tocloft package. I have it almost right, but I would like to remove the numbers of the sections; just leave the section names. I am trying different commands but I can not find the right one. The problem is to maintain the number in the section themselves at the same time.

Any idea?

-

tocloft inserts \cftsecpresnum before placing the section number, and \cftsecaftersnum after it. These are hooks you can use to tie into and grab the number:

\documentclass{book}
\usepackage{tocloft}% http://ctan.org/pkg/tocloft
\makeatletter
\renewcommand{\cftsecpresnum}{\begin{lrbox}{\@tempboxa}}
\renewcommand{\cftsecaftersnum}{\end{lrbox}}
\makeatother
\begin{document}
\tableofcontents
\chapter{A chapter}
\section{First section}
\section{Second section}
\section{Last section}
\end{document}


We effective wrap the numbering mechanism of \section within the ToC inside a box \@tempboxa and store it, but never use it again. This gobbles the contents.

Note that this redefinition is global in terms of the section number display. It can be made local if you only want to display specific parts with/without section numbers. It also maintains the numbering width (set by \cftsecnumwidth). If this should be removed, add

\setlength{\cftsecnumwidth}{0pt}


to the document preamble as well.

-