[Tex/LaTex] TOC style in memoir class

memoirtable of contents

I am attempting to reach the below design for a TOC (but using the memoir class):

enter image description here

Which is basically only presenting the chapter number, name and page and subsection number, name and page. The standard toc strucutre in memoir adds dots between the name and the page, which I am to remove.

I was able to arrive at a partial solution, where I managed to remove the dots in subsections, but not in chapters or in subsections (MWE):

\documentclass{memoir}
\usepackage{lipsum}

\renewcommand*{\cftsectionleader}{}

\tableofcontents*

\begin{document}
\chapter{Introduction}
\section{lipsum}
\lipsum[1-10]
\end{document}

This approach, however, generates malformed lines in the toc:

enter image description here

  • How can I achieve that using only the memoir utilities?

Best Answer

I see you want to reproduce this: https://logic.rwth-aachen.de/~ummels/diss.pdf

One option is to redefine l@chapter and so on:

\documentclass{memoir}
\usepackage{fontspec}
\setmainfont{Minion Pro}

\renewcommand\chapternumberline[1]{\numberline{#1}} %not necessary when using the book class

\makeatletter

\renewcommand*\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \vskip 1ex \@plus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ 
      \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \large  % added for large font for chapters
      %\advance\leftskip\@tempdima
      \hskip -\leftskip %\@chapapp~ \par % added \@chapapp~ \par 
      #1\nobreak \raggedright % originally \hfil
%added for leaders (dots) in chapter in toc
%\xleaders\hbox{$\m@th
%       \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
%        mu$}\hfill%
%%
\nobreak\hb@xt@\@pnumwidth{\hss ~\textbullet~#2}\par\vspace{.5ex} % ADDED VSPACE
      \penalty\@highpenalty
    \endgroup
  \fi}  

\renewcommand*\l@section[2]{%
    \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    %\vskip .5ex \@plus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
    \parindent 3em 
    \rightskip \@pnumwidth
    \parfillskip -\@pnumwidth
    \leavevmode \normalsize %
    \advance\leftskip\@tempdima
    \hskip -\leftskip %
    #1\nobreak \raggedright % originally \hfil
    %added for leaders (dots) in chapter in toc
    %\xleaders\hbox{$\m@th
    %      \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
    %       mu$}\hfill%
    %%%
    \nobreak\hb@xt@\@pnumwidth{\hss \textbullet~#2}\par%\vspace{.5ex} % ADDED VSPACE
    \penalty\@highpenalty
    \endgroup
    \fi} 



\renewcommand*\l@subsection[2]{%
    \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    %\vskip .5ex \@plus\p@
    \setlength\@tempdima{2.3em}%
    \begingroup
    \parindent 5.3em 
    \rightskip \@pnumwidth
    \parfillskip -\@pnumwidth
    \leavevmode \normalsize %
    \advance\leftskip\@tempdima
    \hskip -\leftskip %
    #1\nobreak \raggedright % originally \hfil
    %added for leaders (dots) in chapter in toc
    %\xleaders\hbox{$\m@th
    %      \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
    %       mu$}\hfill%
    %%%
    \nobreak\hb@xt@\@pnumwidth{\hss \textbullet~#2}\par\vspace{1ex} % ADDED VSPACE
    \penalty\@highpenalty
    \endgroup
    \fi}


\makeatother





\begin{document}


\tableofcontents


\chapter{title}
\section{section name}
\subsection{section name}

\chapter{title}
\section{section name}
\subsection{section name}


\chapter{title}
\section{section name}
\subsection{section name}

\chapter{title}
\section{section name}
\subsection{section name}



\end{document}

enter image description here

You may adapt lengths to your taste.

If you want subsections to appear in the TOC in memoir you should add

\setcounter{tocdepth}{2}
\setcounter{secnumdepth}{2}