Take the 2-minute tour ×
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.

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

1 Answer 1

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

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.