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 have a fiction book to typeset and I am using scrbook class as I thought that it is very flexible. For every chapter beginning I am using \chapter{} command and leave the field inside {} empty, so the command gives me only the text "Chapter 1." and so on.

However, if there is no name for a chapter, it does not appear in TOC. Is it possible to make them appear?

I hope this explains what I'm trying to achieve.

EDIT1: I am strongly considering to use memoir class, so if somebody knows how to do this in memoir class, please, let me know.

EDIT2: I just noticed, that with memoir class it happens automatically, but I am still interested in scrbook class hacks.

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

With scrbook you can get what you want with the following:

\documentclass{scrbook}
\renewcommand{\numberline}[1]{\chaptername~#1}
\begin{document}
\tableofcontents
\chapter{\null}
abc
\chapter{\null}
def
\end{document}

I assume that you don't use sections; in that case the trick must be different.


For using also parts, one can take a different approach:

\documentclass{scrbook}
\usepackage{etoolbox}

\makeatletter
\def\part@numberline#1{\partname~#1}
\def\chapter@numberline#1{\chaptername~#1}
\patchcmd{\l@part}{\begingroup}{\begingroup\let\numberline\part@numberline}{}{}
\patchcmd{\l@chapter}{\begingroup}{\begingroup\let\numberline\chapter@numberline}{}{}
\makeatother

\begin{document}
\tableofcontents
\part{\null}
\chapter{\null}
abc
\chapter{\null}
def
\end{document}
share|improve this answer
    
This works if I am using only chapters. Is it possible to do it if I have parts and chapters? Thanks –  gns-ank Aug 10 '12 at 0:12
    
That's an amazing answer... Thank you so much! –  gns-ank Aug 10 '12 at 14:33
add comment

You can use the two lines code before every chapter to do it:

\chapter[]{}
\addcontentsline{toc}{chapter}{\chaptername{} \thechapter}

Minimal example:

\documentclass{scrbook}

\begin{document}
\tableofcontents
\chapter[]{}
\addcontentsline{toc}{chapter}{\chaptername{} \thechapter}

\end{document}

But before every chapter you will not get the word chapter, only the chapter number.

share|improve this answer
add comment

And here's a solution for the book document class. It relies on using the tocloft package.

\documentclass{book}
\usepackage{tocloft}
\renewcommand\cftchappresnum{Chapter }
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{}
\chapter{}
\end{document}

enter image description here

share|improve this answer
add comment

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.