1

I've been trying to add tracking (letter spacing) to my chapter titles with titlesec, but to no avail.

I'm using fontspec and XeTeX, so microtype isn't available to me. Another post said this can be done with \addfontfeatures{LetterSpace=XXX}, but the tracking remains the same.

I'm a TeX newbie, so I'm not sure where the error is in my MWE.

Here's an image and the code I used to produce it:

enter image description here

\documentclass{book}
\usepackage{lipsum}
\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{fmtcount}

\newcommand{\ttlspc}{\addfontfeatures{LetterSpace=20}}
\titleformat{\chapter}[display]{}
    {\ttlspc\filcenter\normalfont\Large\bfseries Part\ \Numberstringnum{\thechapter}}
    {.2cm}
    {\ttlspc\normalfont\Large\itshape\filcenter}

\begin{document}
\chapter{TheNameOfTheChapter}
\lipsum[1]
\end{document}

What can be done to solve my problem?

2
  • 1
    your example produces a warning saying the font feature is ignored here: * fontspec warning: "addfontfeatures-ignored" * * \addfontfeature(s) ignored; it cannot be used with a font that wasn't * selected by fontspec. are you using fontspec to specify a font in your real document? Commented May 26, 2015 at 22:21
  • Ah @DavidCarlisle, I apologize. This wasn't a complete example of what I'm actually doing in my document. I do declare a font with \setmainfont in my actual document, I just didn't include it here. Egreg's solution worked. I made a rookie mistake. :)
    – Nick
    Commented May 26, 2015 at 22:26

1 Answer 1

1

There are two problems; one is minor and is in the fact that you must declare \setmainfont in order to apply \addfontfeatures.

The second problem is due to the fact that you're overriding \ttlspc by saying `\normalfont after it.

\documentclass{book}
\usepackage{lipsum}
\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{fmtcount}

\setmainfont{Latin Modern Roman} % or whatever font

\newcommand{\ttlspc}{\addfontfeatures{LetterSpace=20}}
\titleformat{\chapter}[display]{}
    {\filcenter\normalfont\ttlspc\Large\bfseries Part\ \Numberstringnum{\thechapter}}
    {.2cm}
    {\normalfont\ttlspc\Large\itshape\filcenter}

\begin{document}
\chapter{TheNameOfTheChapter}
\lipsum[1]
\end{document}

enter image description here

Don't use letter spacing unless you're doing all caps or caps and small caps: see http://webtypography.net/2.1.7

Here's a possibility with spaced small caps:

\documentclass{book}
\usepackage{lipsum}
\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{fmtcount}
\setmainfont{Hoefler Text}
\newfontfamily{\romanspaced}{Hoefler Text}[
  LetterSpace=15
]

\newcommand{\ttlspc}{\addfontfeatures{LetterSpace=20}}
\titleformat{\chapter}[display]{}
    {\filcenter\normalfont\romanspaced\Large\scshape Part\ \Numberstringnum{\thechapter}}
    {.2cm}
    {\normalfont\normalsize\romanspaced\scshape\filcenter}

\begin{document}

\chapter{The Name Of The Chapter}

\lipsum[1]

\end{document}

enter image description here

4
  • Thanks for the tip. I actually like the look of smallcaps in my document more than mixed case.
    – Nick
    Commented May 26, 2015 at 22:26
  • @egreg; May I know where from where the tag \romanspaced comes from? Please advise...
    – MadyYuvi
    Commented Mar 31, 2022 at 13:22
  • @MadyYuvi I defined it myself with \newfontfamily
    – egreg
    Commented Mar 31, 2022 at 14:30
  • @egreg Much thanks for your prompt reply...
    – MadyYuvi
    Commented Mar 31, 2022 at 14:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .