2

I am using the companion chapterstyle within the memoir class with XeTeX. To customize the chapter title, I adapted memoir.cls slightly:

\makechapterstyle{companion}{%
    \chapterstyle{default}
    \RequirePackage{fontspec}
    \renewcommand*{\chapnamefont}{\normalfont\sffamily\bfseries\Large\MakeTextUppercase}
    \renewcommand*{\printchaptername}{\raggedleft\chapnamefont \@chapapp}
    \renewcommand*{\chapnumfont}{\normalfont\fontsize{30}{30}\sffamily}
    \renewcommand*{\chaptitlefont}{\normalfont\fontsize{30}{0}\sffamily}
    \setlength{\chapindent}{\marginparsep}
    \addtolength{\chapindent}{\marginparwidth}
    \renewcommand*{\printchaptertitle}[1]{%
    \begin{adjustwidth}{}{-\chapindent}
        \raggedleft \chaptitlefont ##1\par\nobreak
    \end{adjustwidth}}}

What I get is the following: enter image description here

My question is how I can adapt the letterspacing in the word "chapter" so it looks more 'stretched', e.i. like in the following example:

enter image description here

I have tried to add \defaultfontfeatures{LetterSpace=50} in the \chapnamefont rule but this doesn't seem to change anything. I have also tried \lsstyle from the microtype package as described here, but apparently this doesn't work with XeTeX.

0

1 Answer 1

2

You have to do a few things differently

  1. Call fontspec outside \makechapterstyle

  2. Define explicitly the fonts

  3. Use \addfontfeatures.

Here's the code; of course the value 200 is exaggerated, I used it to emphasize the result.

\documentclass{memoir}

\usepackage{fontspec}
\setmainfont{Latin Modern Roman}
\setsansfont{Latin Modern Sans}

\makeatletter
\makechapterstyle{companion}{%
    \chapterstyle{default}
    \renewcommand*{\chapnamefont}{%
      \normalfont\sffamily\bfseries
      \addfontfeatures{LetterSpace=200}% exaggerated
      \Large\MakeTextUppercase
    }
    \renewcommand*{\printchaptername}{\raggedleft\chapnamefont \@chapapp}
    \renewcommand*{\chapnumfont}{\normalfont\fontsize{30}{30}\sffamily}
    \renewcommand*{\chaptitlefont}{\normalfont\fontsize{30}{0}\sffamily}
    \setlength{\chapindent}{\marginparsep}
    \addtolength{\chapindent}{\marginparwidth}
    \renewcommand*{\printchaptertitle}[1]{%
    \begin{adjustwidth}{}{-\chapindent}
        \raggedleft \chaptitlefont ##1\par\nobreak
    \end{adjustwidth}}}
\makeatother

\chapterstyle{companion}

\begin{document}

\mainmatter

\chapter{This is a long chapter title}

\end{document}

enter image description here

1
  • Thank you. I didn't follow steps 1 and 2 earlier because I tried to adapt the memoir.cls-file itself, but now I just putted all this in the preamble of my actual tex-file and it works perfectly. Commented Oct 1, 2016 at 20:40

You must log in to answer this question.

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