How to use fontspec with palatino package?

I am trying to typeset a book in Palatino with a custom font, Rockwell, used for headings. I can easily set the book in Palatino by using the palatino package, if I use the fontspec package to import my Rockwell files, all the body text reverts to default. I tried importing a TTF version of Palatino using fontspec but the result was uglier than the version that comes with the Palatino package.

Basically:

\documentclass[10pt]{book}
\usepackage[paperheight=9in,paperwidth=6in]{geometry}
\usepackage{palatino}
\usepackage{fontspec}

\setmainfont{Palatino}

\begin{document}
This text should be in Palatino.
\end{document}

• You want to change the font only for headings, e.g. chapter titles? – Alenanno Dec 28 '15 at 20:02
• Yes, I want chapter titles to be in Rockwell and everything else to be Palatino. – John Allie Dec 28 '15 at 20:08
• Whay don't you use TeX Gyre Pagella, which a Palatino clone, which exists in .otf format? – Bernard Dec 28 '15 at 20:33

I use the scrbook class to change the heading font easily:

\documentclass{scrbook}
\usepackage[paperheight=9in,paperwidth=6in]{geometry}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}%% The Palatino from the TeX Gyre Project
\newfontfamily\headingfont{RockwellStd}%% I have only the RockwellStd.otf
\begin{document}
\chapter{foo}
\section{bar}
This text should be in Palatino.
\end{document}


• This works, but now  and '' don't render as quotation marks. How can this be fixed? – John Allie Dec 28 '15 at 20:39
• @JohnAllie Add \defaultfontfeatures{Ligatures=TeX} before setting your fonts. – Alan Munn Dec 28 '15 at 20:44
• @JohnAllie: That should be the default. Which TeX distribution you are using. – user2478 Dec 28 '15 at 21:14

The palatino package uses the legacy New Font Selection Scheme to select an 8-bit font. To select (a clone of) Palatino as your main font with fontspec, use

\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont{TeX Gyre Pagella}[Scale=1.0]


On most installations, the palatino package will also get you TeX Gyre Pagella, but with support for fewer characters. I’m not sure where your Palatino.ttf came from, but it might be an older version from Adobe.

Note that, if you genuinely wanted to combine Unicode and legacy 8-bit encodings, you would not load both palatino and fontspec. You would give \setmainfont the option NFSSFamily=qpl to load Pagella when you switch beck to a legacy encoding such as T1.

If you have Rockwell on your system, you probably installed Microsoft Office and therefore also have a genuine version of Palatino. That lets you write

\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont{Palatino Linotype}[Scale=1.0, Ligatures={Common,Discretionary,TeX}]


Apple also distributes a genuine Palatino with its iWork. On a Mac, check your Font Book for Palatino.

You could also use \IfFontExistsTF to load the real thing if you have it, and fall back to the clone if not. You might not want this, as your document would then produce different output if compiled on different installations.

\IfFontExistsTF{Palatino Linotype}%
{\setmainfont{Palatino Linotype}[
Scale=1.0,
Ligatures={Common,Discretionary,TeX}]}%
{\setmainfont{TeX Gyre Pagella}[
Scale=1.0]}


The \defaultfontfeatures command automatically scales all other fonts in the document to match the height of Palatino. If you want to match the cap-height instead of the x-height, change Scale=MatchLowercase to Scale=MatchUppercase.

If you want a matching OpenType math font, load unicode-math and add to your preamble:

\setmathfont{Asana Math}


Or you might try TeX Gyre Pagella Math.

A good sans-serif companion font for Palatino is Optima, also designed by Hermann Zapf. This is available gratis as URW Classico. Since the license is not libre, you can obtain it from TUG with the getnonfreefonts script, or download the files from CTAN. A good matching monospace font is Inconsolata.

To load Rockwell, use a command such as

\newfontfamily\Rockwell{Rockwell}


If you’re using a different version of the font, such as the one from Monotype, you might wish to specify the files you mean more precisely, such as:

\newfontfamily\Rockwell{RockwellStd}[
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic,
Extension = .otf]


You could load Light, condensed or ExtraBold here instead. Add whatever options you need to use its font features. The otfinfo command can tell you what the font supports.

You then would add \Rockwell to the formatting of your headers, in whatever package you use for that.

You can use the titlesec package to change the heading style, including the font. I don't have the Rockwell font, so I used an alternative one to show the difference.

\documentclass[12pt]{book}
\usepackage[a4paper]{geometry}
%\usepackage{palatino}
\usepackage{fontspec}
\usepackage{titlesec}

\setmainfont{Palatino}
\newfontfamily\chapfont{Herculanum}

\titleformat{\chapter}[hang]
{\huge\chapfont}{\thechapter}{20pt}{\Huge}

\begin{document}
\chapter{Chapter in another font}
My text is in Palatino, though.

\end{document}


I just put \usepackage{Palatino} right after documentclass and it automatically changes to Palatino. The editor I use is Texpad but it should work on any editor for LaTex.

• This will only work with legacy 8-bit fonts, not with fontspec. – Davislor Sep 6 '20 at 2:37