1

I am aware that tocstyle may have compatibility problems, but it provides, with a few commands, all the predefined styles I may want. On the other hand, I might use titletoc, but it seems less convenient (lots of lines of code to do something I could do with 2 lines with tocstyle). However, tocstyle seems to have some incompatibility with the mwcls classes -- the document compiles (i.e., the pdf looks ok), but there are warnings:

Missing number, treated as zero. \begin{document}
Undefined control sequence. \begin{document}

MWE:

\documentclass{mwbk} 
\usepackage{blindtext}

\usepackage[tocgraduated]{tocstyle}

\usetocstyle{nopagecolumn}

\begin{document}



\tableofcontents

\frontmatter

\chapter{title}

\chapter{title}

\mainmatter

\chapter{This is a huge chapter name just for testing. This is a huge chapter name just for testing. This is a huge chapter name just for testing. }

\chapter{This is a huge chapter name just for testing. This is a huge chapter name just for testing. This is a huge chapter name just for testing with Lualatex}

\chapter{title}

\blinddocument

\end{document}

1 Answer 1

3

Note that there is only an alpha version of package tocstyle and AFAIK it is not developed anymore. You could use package tocbasic instead:

\documentclass{mwbk} 
\usepackage{blindtext}
\usepackage{expl3}
\usepackage{tocbasic}

\ExplSyntaxOn
\clist_map_inline:nn 
  {chapter,section,subsection,subsubsection,paragraph,subparagraph,figure,table}
  {
    \DeclareTOCStyleEntry[
      linefill=\quad,
      raggedpagenumber,
      pagenumberbox=\hbox
    ]{tocline}{#1}
  }
\ExplSyntaxOff
\DeclareTOCStyleEntry[
  entryformat=\sffamily\textbf,
  pagenumberformat=\normalfont
]{tocline}{chapter}
\makeatletter
\renewcommand\@tocrmarg{0pt}
\makeatother

\begin{document}
\tableofcontents
\frontmatter
\chapter{title}
\chapter{title}
\mainmatter
\chapter{This is a huge chapter name just for testing. This is a huge chapter name just for testing. This is a huge chapter name just for testing. }
\chapter{This is a huge chapter name just for testing. This is a huge chapter name just for testing. This is a huge chapter name just for testing with Lualatex}
\chapter{title}
\blinddocument
\end{document}

Result:

enter image description here

You must log in to answer this question.