If I use the newpx package and then load fontspec and try to select a font it fails. See the minimal example below.

The files (compiled with lualatex) for which fontspec font selection fails (by loading newpx before fontspec) with TeX Live 2021 and the packages up to date (via tlmgr) today (2022-03-28) used to work with an earlier TeX Live version (TeX Live 2020, or 2021 but with older versions of the packages, I can't tell exactly when).

I can't tell if the problem is due to newpx or fontspec (or luaotfload or something else).

Could you help me identify the cause, find a workaround and tell me who to report the problem to so that it can be fixed?

Thanks and have a nice day

%%%% MWE


\usepackage{newpxtext}  % comment newpx and everything is ok
% this used to work with an older version of TeX Live (older version of the packages)
% \usepackage{kurier}  % not needed

\setmainfont{texgyrebonum-regular.otf}  % font selection by file name gives no error but does not select the correct font: newpx font (TeXGyrePagellaX) used instead of TeX Gyre Bonum

\setsansfont{Kurier}  % font selection by font name gives a fontspec error: "The font (Kurier, or any other font selected by font name) cannot be found"




  • 1
    What would be the reason to load newpxtext and then use a different font?
    – egreg
    Mar 28, 2022 at 20:50
  • 2
    it would really help if you would mention what you mean by "it fails". Do you get an error? And if yes which one? Mar 28, 2022 at 20:53
  • @egreg: This is for illustration reason of font selection by file name vs by font name. I am using newpxtext as my main font but calling other fonts via fontspec and it now fails if I use the newpxtext package.
    – Xorios
    Mar 29, 2022 at 11:01
  • @UlrikeFischer: Actually I put the error (or incorrect behavior) as a comment in the MWE after \setmainfont{texgyrebonum-regular.otf} and \setsansfont{Kurier}. And I guess this is reproducible for anyone with an up-to-date TeX Live.
    – Xorios
    Mar 29, 2022 at 11:02
  • yes, sorry I saw that later. But you should better mention such error messages in the main text, or put them at least above the lines. Error messages that you only see if you scroll are easy to overlook. Mar 29, 2022 at 11:54

2 Answers 2


The problem should be reported to the newpxtext author, but you also shouldn't load the newpxtext package if you don't actually want to use it's font.

The reason that font loading fails after \usepackage{newtxtext} is that newtxtext executes \defaultfontfeatures with a bunch of features which really only apply to it's own font, but since they are set as a default they affect all further loaded fonts. Especially it sets the option Extension = .otf specifying that all following names should be interpreted as filenames of .otf files.

The best fix is not to load newpxtext but you can also fix the \defaultfontfeatures issue by resetting the default font features: Add \defaultfontfeatures{} between loading newpxtext and loading another font.

This still leaves the issue that your font change does not actually get applied. That's because the newpxtext package expects that it's only loaded when it should actually control the font and therefore changes the font only in \begin{document} probably to stop the preamble from interfering. You could probably avoid that by moving \setmainfont after \begin{document} but at that point you are going through a lot of trouble just to load a package you don't actually want to use...

  • Yes my example is a bit confusing but in my non minimal file I actually use newpx as the main font. And I have a few calls to other fonts punctually via the \fontspec command) which failed as the MWE with Kurier above). I probably should have shown the font selection by file name with \setmonofont or a \fontspec command in the document instead of \setmainfont.
    – Xorios
    Mar 29, 2022 at 11:08
  • Thanks for the explanation on the main cause. I'll send an e-mail to the author of newpx referring to this answer. In fact as said in my question the behavior of newpx, fontspec or luaotfload must have changed over time because several months ago my file was compiling without problem and lately it produces the above errors.
    – Xorios
    Mar 29, 2022 at 11:09

If you want to use a version of Palatino with fontspec, use

\setmainfont{TeX Gyre Pagella}



Both of these are clones of Adobe’s Palatino. You can also use a version of Palatino that you have installed on your system, such as Palatino Linotype with Microsoft Windows or Office.

If you also want to replace newtxmath, load unicode-math and then use either

\setmathfont{TeX Gyre Pagella Math}


\setmathfont{Asana Math}
  • 1
    In fact I replaced newpxtext by Domitian. To have a layout with line breaks / page breaks similar to what I had with newpxtext (and the microtypigraphic settings of spacing, stretch and shrink that I had) Domitian was more similar to my newpxtext than TeX Gyre Pagella.
    – Xorios
    Mar 29, 2022 at 11:05

You must log in to answer this question.

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