[Tex/LaTex] Spacing in \chaptertitlename

microtypesectioningtitlesec

Consider the following MWE:

\documentclass{book}
\usepackage{titlesec} 
\usepackage{lipsum} % just to generate text for the example
\usepackage[tracking=smallcaps]{microtype}

\titleformat{\chapter}[display]
  {\bfseries\Large}
  {\filright\MakeUppercase{\chaptertitlename} \Huge\thechapter}
  {1ex}
  {\titlerule\vspace{1ex}\filleft}
  [\vspace{1ex}\titlerule]

\begin{document}

\chapter{Test Unnumbered Chapter}
\lipsum[1-2]
\chapter{Test Numbered Chapter}
\lipsum[1-2]
{\scshape Test}
\end{document}  

How can we edit the \chaptertitlename command so that it spaces out correctly by using the microtype package?

Best Answer

Putting it into a \textls{...} spaces it out.

\documentclass{book}
\usepackage{titlesec} 
\usepackage{lipsum} % just to generate text for the example
\usepackage[tracking=smallcaps]{microtype}

\titleformat{\chapter}[display]
  {\bfseries\Large}
  {\filright\textls{\MakeUppercase{\chaptertitlename}} \Huge\thechapter}
  {1ex}
  {\titlerule\vspace{1ex}\filleft}
  [\vspace{1ex}\titlerule]

\begin{document}

\chapter{Test Unnumbered Chapter}
\lipsum[1-2]
\chapter{Test Numbered Chapter}
\lipsum[1-2]
{\scshape Test}
\end{document} 

The result is a fine example of why even wonderful microtype, or any other automatic way of letterspacing currently available in *TeX, is unsuitable for creating letter-spaced all-caps that actually look good. That's because TeX has no knowledge of what a given letter looks like. So in letterspacing, an A is treated the same as a V or an O, which obviously isn't how it's done. That's why in TeX, we can't have, e.g., optical kerning -- which would be pretty handy here.

enter image description here

In this case, there's no need to worry, though. Larger text usually benefits from tighter spacing. Large all-caps you can simply leave at default spacing IMHO.

Related Question