# Classicthesis/arsclassica ToC section numbers too wide (and incoherent font)

Desired result:

\documentclass{scrbook}

\usepackage{classicthesis}
%\usepackage{arsclassica}

\begin{document}

\tableofcontents

\setcounter{chapter}{10}
\chapter{Some chapter}
\section{Some section}

\end{document}


In the following example the section number in ToC is too close to the section title (due to microtype's tracking):

\documentclass{scrbook}

\usepackage{classicthesis}
%\usepackage{arsclassica}

\microtypesetup{tracking=true}

\begin{document}

\tableofcontents

\setcounter{chapter}{10}
\chapter{Some chapter}
\section{Some section}

\end{document}


The same applies to both chapter and section ToC entries a similar example without tracking:

\documentclass{scrbook}

\usepackage{classicthesis}
%\usepackage{arsclassica}

\begin{document}

\tableofcontents

\setcounter{chapter}{100}
\chapter{Some chapter}
\section{Some section}

\end{document}


Also, when classicthesis is changed to arsclassica, another strange behavior is observed – font is incoherent for the first ToC character:

\documentclass{scrbook}

%\usepackage{classicthesis}
\usepackage{arsclassica}

\begin{document}

\tableofcontents

\setcounter{chapter}{10}
\chapter{Some chapter}
\section{Some section}

\end{document}


How can I get sufficient width of chapter/section/… fields (boxes?) in ToC without giving up microtype's tracking and also possibly get rid of font inconsistency in arsclassica?

## 2 Answers

Note that André Miede, the author of classicthesis, mentioned in the documentation:

Page 6: As a new feature, Lorenzo Pantieri’s arsclassica is available as well. As Lorenzo’s package is discontinued and with his permission, classicthesis-arsclassica.sty is now part of classicthesis and will be maintained here.

So you may now write

\usepackage[style=arsclassica]{classicthesis}


to access the arsclassica style.

# Font incoherence is caused by classicthesis’s implementation

The ToC is customized via the tocloft package. In particular, the chapter number is affected by this line in classicthesis.sty:

% from classicthesis'
\renewcommand{\cftchappresnum}{\spacedlowsmallcaps}%


where \spacedlowsmallcaps is defined by

% from classicthesis'
% engine-dependent letterspacing
% if engine = pdfLaTeX, then
\DeclareRobustCommand{\spacedlowsmallcaps}[1]{\textls[80]{\ct@caps\MakeTextLowercase{#1}}}
% if engine = XeLaTeX, then
\DeclareRobustCommand{\spacedlowsmallcaps}[1]{{\addfontfeatures{LetterSpace=14.0}\ct@caps\MakeTextLowercase{#1}}}% WordSpace=1.8


This has really bad interaction with how tocloft redefines \numberline:

% from tocloft'
\let\@cftbsnum \cftchappresnum
...
\renewcommand{\numberline}[1]{%
\hb@xt@\@tempdima{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}


It should be clear now that during macro expansion only the leftmost character of #1 is grabbed by \spacedlowsmallcaps. So when \ct@altfont becomes \sffamily in the arsclassica style, only the first digit becomes sans-serif.

A quick fix is to redefine \numberline again by putting that #1 in a pair of {}:

\documentclass{scrbook}

\usepackage[style=arsclassica]{classicthesis}

% redefine \numberline again
\makeatletter
\renewcommand{\numberline}[1]{%
\hb@xt@\@tempdima{\@cftbsnum{#1}\@cftasnum\hfil}\@cftasnumb}
\makeatother

\begin{document}

\tableofcontents

\setcounter{chapter}{14}% changed for illustration
\chapter{Some chapter}
\section{Some section}

\end{document}


This is definitely a bug, I shall report this issue on André Miede’s website.

# Additional space in ToC after chapter number

Edited: Writing \microtypesetup{tracking=true} is NOT recommended! The classicthesis package has its own engine-dependent way of dealing with letter-spacing. This is implemented by \spacedallcaps and \spacedlowsmallcaps. In short, the package already uses tracking.

Tracking is meant to increase the inter-letter spacing between small capitals. So the cramped space after the chapter number is to be expected. Again, after a quick read through the classicthesis documentation, we find:

Page 7: manychapters: if you need more than nine chapters for your document, you might not be happy with the spacing between the chapter number and the chapter title in the Table of Contents …

However, simply writing

\usepackage[manychapters]{classicthesis}


is not satisfactory. So we can borrow and modify the code from classicthesis.sty:

\documentclass{scrbook}

\usepackage{classicthesis}

\settowidth{\newchnumberwidth}{00} % <--- tweak here if more space required
\addtolength{\cftchapnumwidth}{\newchnumberwidth}%
\addtolength{\cftsecnumwidth}{\newchnumberwidth}
\addtolength{\cftsecindent}{\newchnumberwidth}
\addtolength{\cftsubsecnumwidth}{\newchnumberwidth}
\addtolength{\cftsubsecindent}{2\newchnumberwidth}
\addtolength{\cftsubsubsecnumwidth}{\newchnumberwidth}

\begin{document}

\tableofcontents

\setcounter{chapter}{100}
\chapter{Some chapter}
\section{Some section}

\end{document}


• Interesting, everything seems to be up to date, e.g., classicthesis v4.6, arsclassica ver. 11/01/2017, but the first ToC character still seems to be from different font family. I also observe the same behavior on another machine, both using MiKTeX (with freshly updated packages) on Windows 10. It persists after switching to \usepackage[style=arsclassica]{classicthesis}. – Peter Aug 11 '18 at 23:17
• @Peter Thank you for telling me! My further investigation led to the discovery of an apparent bug of classicthesis. Please check my updated answer. I think there must be some better way to implement tracking. In your case, using \microtypesetup{tracking=true} will cause “double tracking”, which is wrong. I don’t know if the current \textls[...]{} or \addfontfeatures{LetterSpace=...} implementation could be improved. – Ruixi Zhang Aug 12 '18 at 2:57

Maybe the following helps:

\documentclass{scrbook}

%\usepackage{classicthesis}

\usepackage{arsclassica}
\renewcommand{\cftchappresnum}{\scshape\MakeTextLowercase}

\microtypesetup{tracking=true}

\settowidth{\newchnumberwidth}{\cftchappresnum 99}
\addtolength{\cftchapnumwidth}{\newchnumberwidth}%
\addtolength{\cftsecnumwidth}{\newchnumberwidth}
\addtolength{\cftsecindent}{\newchnumberwidth}
\addtolength{\cftsubsecnumwidth}{\newchnumberwidth}
\addtolength{\cftsubsecindent}{2\newchnumberwidth}
\addtolength{\cftsubsubsecnumwidth}{\newchnumberwidth}

\begin{document}
\tableofcontents
\setcounter{chapter}{100}
\chapter{Some chapter}
\section{Some section}
\end{document}
`

• Ah… I was too focused on quoting from the package documentation to realize you posted an answer before me. However, I decide to keep my answer as it adds additional information on the subject. :) – Ruixi Zhang Aug 11 '18 at 22:17