TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that you can use \setmainfont for normal text but is there any command that will apply a font only to headers (chapters, sections, subsections)?

share|improve this question

migrated from stackoverflow.com Aug 22 '11 at 13:24

This question came from our site for professional and enthusiast programmers.

up vote 7 down vote accepted

Using fontspec, you can define any font you want in XeTeX. You can then use them in the places of your choice by using the macro names you chose.

If you want to change the fonts used in sections, you can combine fontspec with titlesec. Example:

\setmainfont{Linux Libertine O}
\newfontfamily\secfont{EB Garamond}


  {\secstyle} % format
  {} % label
  {10pt} % sep
  {} % before
  [\normalfont] % after

will use Linux Libertine O as main font and EB Garamond as section font.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.