4

I want to format the table of contents of a reader in a non-standard manner, see example:

enter image description here

In particular, the sections are listed 'inline', without page numbers, separated by bullets and indented w.r.t. the chapter listing. The unnumbered 'chapters' (bibliography, index, etc.) at the end of the document are aligned with the chapter numbers, not indented.

Unfortunately I haven't been able to find a transparent explanation of how to achieve this. A bit of searching got me to this question on this site, which has an answer with a table of contents that looks somewhat similar to what I'm looking for, see the image below.

The problem is that the accompanying code is a complete mystery to me, I am unable to find any useful correlation between the code and the output. I hope someone here can either explain to me what the code does, or show me another way to get the look I want. Needless to say I'm a novice at TeX.

enter image description here

Thanks in advance

1 Answers1

5

Here is a solution using etoc package

\documentclass{book}
\usepackage{mwe}

\usepackage{etoc}
\setcounter{tocdepth}{1}

\begin{document}
\begingroup
\parindent=0pt
\etocsetstyle{chapter}
{}
{\leavevmode\leftskip0em\relax}
{\etocifnumbered{\makebox[1.5em][l]{\etocnumber.}}{}%
\etocname\nobreak\hfill\nobreak
\rlap{\makebox[1.5em]{\etocpage}}\par}
{}
\etocsetstyle{section}
{\begingroup\leftskip1.5em\relax}
{\textbullet\hspace\itemsep%
\nolinebreak}
{\etocname\space}
{\par\endgroup}
\tableofcontents
\endgroup

\blinddocument
\blinddocument
\cleardoublepage
\addcontentsline{toc}{chapter}{\bibname}
bye
\end{document}

enter image description here


Update (edited)

\documentclass{book}
\usepackage{mwe}

\usepackage{etoc}
\setcounter{tocdepth}{1}

\begin{document}
\begingroup
\parindent=0pt
\etocsetstyle{chapter}
{}
{\leavevmode\leftskip0em\relax}
{\etocifnumbered{\makebox[1.5em][l]{\etocnumber.}}{}%
\etocname\nobreak\hfill\nobreak
\rlap{\makebox[1.5em]{\etocpage}}\par}
{}
\etocsetstyle{section}
{\begingroup\leftskip1.5em\relax}
{\etociffirst{}{\textbullet\hspace\itemsep%
\nolinebreak}}
{\etocname\space}
{\par\endgroup}
\tableofcontents
\endgroup

\blinddocument
\blinddocument
\cleardoublepage
\addcontentsline{toc}{chapter}{\bibname}
bye
\end{document}
touhami
  • 19,520