# Change sans serif and serif fonts separately for pdflatex

How does one change the default sansserif font (e.g. when using it for headings and using according commands to switch headings to sffamily), independently from a default roman font (e.g. for the text)?

For instance, I would like to have the Domitian font (which exists only as serif) for the main text, and Epigrafica (which is only sansserif) for the Chapter, Section etc. headings.

• can you use your fonts with pdflatex at all? Do you have an example? Jan 6, 2021 at 15:11
• Please tell us (a) which document class you employ, (b) whether you load packages such as `titlesec` and `sectsty` which can be used to modify the appearance of sectioning headers, and (c) how the fonts Domitian and Epigrafica are supposed to be loaded.
– Mico
Jan 6, 2021 at 16:01

With LuaLaTeX or XeLaTeX, load `\usepackage{fontspec}` and use the `\setsansfont` command. This is what you should use for any font that isn’t a legacy 8-bit TeX font. Typically, you would load the different font family with `[Scale=MatchUppercase]` or `[Scale=MatchLowercase]`, depending on whether you want the capital or lowercase letters of your fonts to have the same height.

Otherwise, you should have a Type-1 font package, and load that. Check the package documentation for the options it supports.

The `epigraphica` package exists, but if it’s setting your `\familydefault` and does not have a way to turn that off, first try loading your packages in a different order:

``````\usepackage{epigraphica}
\usepackage{domitian}
``````

This usually makes the package that you load last override the conflicting settings in the other one, but not always. If that fails, you can try to change `\familydefault` manually in the preamble. Something like

``````\renewcommand\familydefault\rmdefault
``````

might work, or

``````\renewcommand\rmdefault{Domitian-TOsF}
``````

In some cases, a package hooks its changes so they take effect at the end of the preamble, and you can only override them with something like,

``````\AtBeginDocument{\renewcommand\familydefault\rmdefault}
``````