11

I'm currently writing my thesis, using the book class. I am trying to display the table of contents in this manner:

toc

And each chapter is displayed this way:

chapter

I'm fairly new to latex and this is my first time writing a thesis so I don't know exactly how to format it this way. Any ideas would be great!

Thanks!

1
  • okay so the default display for chapter is what i had shown (somehow i missed that), so I'd just like to get an idea about how to modify the toc i think
    – muddy
    Dec 24, 2013 at 0:51

1 Answer 1

11

The following patch of \l@chapter via etoolbox is sufficient:

enter image description here

\documentclass{report}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\l@chapter}% <cmd>
  {#1}% <search>
  {\def\numberline##1{\@chapapp~##1\hfill\mbox{}\par\nobreak}#1}% <replace>
  {}{}% <success><failure>
\makeatother

\begin{document}

\tableofcontents

\chapter{Introduction}

\chapter{Preliminaries}
\section{Problem definition}
\section{Genetic algorithms}
\section{Ant algorithms}
\section{Previous work}
\end{document}
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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