TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using the documentclass scrbook (KOMA) with tocloft and would like to get rid of all the numberings of the chapters, sections and subsections in the table of content, but not in the content and as well not in the other lists I will have (such as list of figures, list of terms, list of mentioned authors etc.) themselves.

There is already a similar question posed here, but now I would like to get a solution for this specific case. Here is a solutions, which disables all numberings in all lists by lockstep. But as mentioned above I need one, where I could specify it for each category of lists (list of figures, list of xxxx. etc.).

\documentclass{scrbook}

\usepackage{tocloft}

\usepackage{lipsum}

\makeatletter

% Without number and indentation
\renewcommand*{\numberline}[1]{}

\makeatother

\begin{document}

\tableofcontents 
share|improve this question
up vote 3 down vote accepted

Before you redefine \numberline to do nothing (or more precisely, to gobble its argument), make a copy named, say, \oldnumberline. Then use the etoolbox package to patch the internal LaTeX macro \@caption (which is used for floats like figure and table) to use \oldnumberline instead of \numberline.

\documentclass{scrbook}

\usepackage{tocloft}

\usepackage{etoolbox}

\usepackage{lipsum}

\makeatletter
\let\oldnumberline\numberline
\patchcmd{\@caption}{\numberline}{\oldnumberline}{}{}
\renewcommand*{\numberline}[1]{}
\makeatother

\begin{document}

\tableofcontents

\listoffigures

\chapter{foo}

\section{foobar}

\subsection{foobargnu}

\lipsum

\begin{figure}
\centering
\rule{1cm}{1cm}% placeholder for graphic
\caption{A figure}
\end{figure}

\end{document}

enter image description here

share|improve this answer

Do not use tocloft together with a KOMA-Script class. You can use option

toc=indenttextentries

and redefine \addtocentrydefault to get ride of all entry numbers in TOC.

\renewcommand\addtocentrydefault[3]{%
  \addcontentsline{toc}{#1}{\nonumberline#3}}

And you can use

\RedeclareSectionCommand[style=section,indent=0pt]{chapter}

locally to avoid an automatic page break before the list starts.

enter image description here

Code:

\documentclass[toc=indenttextentries]{scrbook}
\usepackage{lipsum}

\renewcommand\addtocentrydefault[3]{%
  \addcontentsline{toc}{#1}{\nonumberline#3}}

\begin{document}

\begingroup
  \RedeclareSectionCommand[style=section,indent=0pt]{chapter}
  \thispagestyle{plain}
  \tableofcontents
  \listoffigures
\endgroup

\chapter{foo}
\section{foobar}
\subsection{foobargnu}
\lipsum
\begin{figure}
\centering
\rule{1cm}{1cm}% placeholder for graphic
\caption{A figure}
\end{figure}
\end{document}

Update

Starting with KOMA-Script version 3.20 you can use \RedeclareSectionCommand to remove the entry numbers in TOC.

\documentclass{scrbook}[2016/05/10]
\usepackage{lipsum}

\newcommand\remove[1]{}
\RedeclareSectionCommands[
  tocnumwidth=0pt,
  tocentrynumberformat=\remove
]{part,chapter,section,subsection,subsubsection}


\begin{document}
\tableofcontents
\listoffigures
\chapter{foo}
\section{foobar}
\subsection{foobargnu}
\lipsum
\begin{figure}
\centering
\rule{1cm}{1cm}% placeholder for graphic
\caption{A figure}
\end{figure}
\end{document}

enter image description here enter image description here enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.