0

I want a to define a section heading that features:

  • a light and a bold font weight
  • adjusted letter spacing
  • a local truetype font (fontspec package)
  • correct referencing in pdf table of contents

This is what came closest:

\documentclass[a4paper, 11pt]{scrartcl}%
\usepackage[ngerman]{babel}%
\usepackage{hyperref}%
\hypersetup{%
  plainpages=false,
  colorlinks=false,
  pdfborder={0 0 0},
  breaklinks=true,
  bookmarksnumbered=true,
  bookmarksopen=true
}%

\usepackage{kantlipsum}%
\usepackage{fontspec}%
\setmainfont[%
  Path           = /usr/share/fonts/truetype/OpenSans/,
  Extension      = .ttf,
  Ligatures      = TeX,
  BoldFont       = OpenSans-Semibold,
  ItalicFont     = OpenSans-Italic,
  BoldItalicFont = OpenSans-BoldItalic
]{OpenSans-Light}%

\newfontfamily{\OSLight}{Open Sans Light}%
\newfontfamily{\OSBold}{Open Sans Bold}%

\newcommand\ibsection[2]{{\section{\OSLight{\addfontfeature{LetterSpace=-5}#1} \OSBold{\addfontfeature{LetterSpace=-5}#2}}}}%


\begin{document}

\tableofcontents

\ibsection{Der Philosoph}{Immanuel Kant}

\kant[1]

\ibsection{Der}{kategorische Imperativ}

\kant[2]

{\Large \OSLight{\addfontfeature{LetterSpace=-5} Der Philosoph }\OSBold{\addfontfeature{LetterSpace=-5} Immanuel Kant}}

\end{document}

This solution is not satisfying for two reasons:

  1. The light font weight of the section heading is rather regular than light. Please see image. I want the heading to be like it is at the bottom.
  2. The table of contents within the pdf file shows the text LetterSpace=-5. Please also see the image below.

mwe

I know there is microtype package with a letter spacing option. Not applicable here as I use fontspec package and XeLaTeX.

I am also aware of opensans package. Not an option because I want to be able to use other locally stored fonts.

The question of course is, how to achieve what I'm looking for?

  • 1
    You can move the Letterspace-option to the font definition: \newfontfamily{\OSLight}{Open Sans Light}[LetterSpace=-5] and in the section add \mdseries \newcommand\ibsection[2]{\section{{\OSLight \mdseries #1} {\OSBold #2}}}. Imho your layout looks rather ugly. – Ulrike Fischer Apr 4 '17 at 12:17
  • Great. The \mdseries does change the font weight. Moving the letterspace option to the font definition as you suggest produces an error: LaTeX Error: Missing \begin{document}. I assume it worked for you. Any idea why it didn't for me? – jmjr Apr 4 '17 at 12:33
  • Too old fontspec? Try \newfontfamily{\OSLight}[LetterSpace=-5]{Open Sans Light} – Ulrike Fischer Apr 4 '17 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.