Incoherent font for chapter numbers in ToC
In a recent TeX.SX post, @Peter noticed that only the first digit of the chapter number in the ToC was correctly set to \sffamily
while the rest digits were in \rmfamily
(when the arsclassica
style is used). Here is a MWE to illustrate the problem:
\documentclass{scrbook}
\usepackage[style=arsclassica]{classicthesis}
\begin{document}
\tableofcontents
\setcounter{chapter}{110}% changed for illustration
\chapter{Some chapter}
\section{Some section}
\end{document}
In my answer, I proposed to redefine \numberline
to accommodate classicthesis
’s implementation. But a self-contained solution is much preferable.
Due to the way classicthesis
implements tracking/letterspacing, care must be taken whenever \spacedallcaps
and \spacedlowsmallcaps
are used. Instead of changing \numberline
from tocloft
, the following takes care of the chapter number:
% Changing `classicthesis.sty'
...
\renewcommand{\cftchappresnum}{\spacedlowsmallcaps\bgroup}% <- add `\bgroup'
\renewcommand{\cftchapaftersnum}{\egroup}% <- this line inserted
\renewcommand{\cftchapaftersnumb}{\spacedlowsmallcaps}% <- no change needed
...
Modifications as the above should be made for \cftsecpresnum
, \cftsubsecpresnum
, \cftsubsubsecpresnum
(because of \MakeTextLowercase
) and/or \cftfigpresnum
, \cfttabpresnum
, \cftlistingspresnum
(I don’t see why you have two \renewcommand
’s for these three).
P.S. I suppose the original design didn’t expect more than nine chapters. May I suggest changing \settowidth{\newchnumberwidth}{.}
to \settowidth{\newchnumberwidth}{0}
? The box width is increased by one digit width, which seems more natural for two-digit chapter numbers.
P.P.S. I also noticed that tracking was set differently: With pdfTeX and LuaTeX, we have \textls[160]{...}
for upper case and \textls[80]{...}
for lower case. But with XeTeX, we have LetterSpace=18.0
for upper case and LetterSpace=14.0
for lower case. Are there some conversion factors used, or are the different settings made just by designing intuition?
Comments (9)
-
-
reporter @Ivo Thank you for your response. The problem of the hook
\cft*presnum
is that it merely prepends code in front of the number and it was not designed to take mandatory argument. Inclassicthesis
, the expansion of\cftchappresnum
unfortunately falls behind the expansion of\thechapter
, and thus only the first digit is grabbed. Indeed, if we were to write\DeclareRobustCommand{\spacedlowsmallcaps}{\lsstyle\ct@caps}
(for pdfTeX), then\ct@altfont
would be applied correctly. But, 1) I don’t know if there is a\lsstyle
-equivalence for XeTeX, and 2) The upper- and lower-casing are really tricky. Finally, please discard my comment onWordSpace
. I shall edit it to clarify my intention. -
reporter - edited description
Clarified comment on tracking
-
repo owner -
assigned issue to
Thank you very much for you input and your patience. I will look into this for the next release.
-
assigned issue to
-
repo owner - changed status to open
-
repo owner Again, thank you for your detailed input and your patience.
Today, I did some tests with your MWE, adding
manychapters=true
:
Wouldn't this be the expected result (
111
in sans-serif)? -
repo owner P.S.: Changing to
\settowidth{\newchnumberwidth}{0}
is a good idea, thx! Done.P.P.S.: Uhm, yes, designing intuition.
-
repo owner - changed status to resolved
-
repo owner - changed status to closed
- Log in to comment
Dear Rueyshi, thanks for your report. I'm sure there are many other places like this where applying spaced caps only affects the first character due to lacking (?) implementations of different hooks in packages classicthesis is using. I suppose we could redefine the \cft* commands as you're proposing; it may take some time, though. The whole problem with spaced caps comes from the way upper/lowercasing in TeX/LaTeX works. As for the WordSpace - this is as a matter of fact not used (it's in a comment to remind us of the possibility) because of the statement in the fontspec manual saying "Note that TeX’s optimisations in how it loads fonts means that you cannot use this feature in \addfontfeatures." Why fontspec instead of microtype tracking? Simple reason - microtype tracking does not work with XeTeX.