# How to get a very compact TOC

This is how the original TOC looks.

This original format of the table of contents takes too much space. I wanted some format that is compact and found this sample.

I am also searching for other nicer looking formats that are compact. For example

• I suppose the non-numbered items correspond to unnumbered sections in the body of the book? What is your question? – Bernard Feb 26 '16 at 12:45
• nope the structure of TOC – Boltzee Feb 26 '16 at 12:50
• On which criteria are some items numbered and others not, then? – Bernard Feb 26 '16 at 12:52
• Actually I am not worried about the numbering I added some image that will just reflect my requirement. I am OK with any compact toc format. Currently my table of contents takes some 4 pages and the the work is not even half complete – Boltzee Feb 26 '16 at 12:55

The titletoc can achieve this though the \titlecontents command. The starred version places all the titles on the same paragraph.

The command isn't the most user friendly to use, so I tried to annotate as best as I could.

\documentclass{book}

\usepackage{titletoc}
\titlecontents{chapter}             % Section
[0em]                             % Left
{\vspace*{\baselineskip}}         % Above code
{}                                % Numberless format
[]                                % Separator
\titlecontents*{section} % Section
[0em]                  % Left
{\space}               % Above code
{\thecontentslabel~}   % Numbered format
{}                     % Numberless format
{}                     % Filler
[.\space]              % Separator
\titlecontents*{subsection} % Section
[0em]                     % Left
{\space}                  % Above code
{}                        % Numbered format
{}                        % Numberless format
{}                        % Filler
[.\space]                 % Separator

\begin{document}

\tableofcontents

\clearpage

\chapter{Introduction}

\chapter{The Principle of Locality in Classical Physics and the Relativity Theories}

\subsection{Fields}

\section{Special relativity}

\subsection{Poincar\'e group}
\subsection{Lorentz group}
\subsection{Spinors}
\subsection{Conformal group}

\section{Maxwell theory}

\section{General Relativity}

\chapter{Poincar\'e Invariant Quantum Theory}

\section{Geometric symmetries in quantum physics}
\subsection{Projective representations and the covering group}

\section{Wigner's analysis of irreducible, unitary representation of the Poincar\'e group}

\section{Single particle states}
\subsection{Spin}

\section{Many particle states: Bose--Fermi alternative, Fock space, creation operators}
\subsection{Separation of CM-motion}
\end{document}


An important thing to note is that due to the way the table of contents is generated, LaTeX struggles to create line breaks. In order to allow line breaks between successive elements, I have added \space in the above code and also in the separator. Do not use ~ as this is creates a space that cannot break across lines. The only time I have used ~ is between the a section's number and its title in order to avoid:

The memoir class helps with this. For example look at A Few Notes on Book Design (texdoc memdesign) where the subsubsections under each chapter in the ToC are set as a single paragraph. This document used the memoir class using the memoir macro \setupparasubsecs. You can use this, as well as many other memoir facilities, as a basis for configuring your compressed ToC.