3

I wish to use old style numbers, and I can do this fairly easily with PDFLaTeX with the following code:

\documentclass[a4paper,10pt]{article}
\usepackage[osf]{mathpazo}
\begin{document}
1234567890
\end{document}

The output:

pdflatex test.tex 
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/mathpazo.sty)
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def)
(./test.aux) (/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1pplj.fd)
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux) ){/usr/shar
e/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc}</usr/share/texlive/texmf-dist
/fonts/type1/public/fpl/fplrc8a.pfb>
Output written on test.pdf (1 page, 13241 bytes).
Transcript written on test.log.

However, if I compile with XeLaTeX, it compiles fine, but it gives a warning, and does not produce the old style figures I'm looking for. This is the output I got from XeLaTeX:

xelatex test.tex 
This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019/Debian) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/mathpazo.sty)
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-xdvipdfmx.def)
(./test.aux) (/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd)

LaTeX Font Warning: Font shape `TU/pplj/m/n' undefined
(Font)              using `TU/lmr/m/n' instead on input line 4.

[1] (./test.aux)

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

 )
Output written on test.pdf (1 page).
Transcript written on test.log.
0

2 Answers 2

3
\documentclass[a4paper,10pt]{article}
\usepackage{unicode-math}
\setmainfont[Numbers=OldStyle]{TeXGyre Pagella}
\setmathfont{texgyrepagella-math}[AutoFakeBold]
\begin{document}
    1234567890
\end{document}
2
  • I compiled that and got the following error: ! Package fontspec Error: The font "TeXGyre Pagella" cannot be found.
    – JRCSalter
    Commented Oct 1, 2022 at 18:20
  • Use \setmainfont[Numbers=OldStyle]{texgyrepagella-regular.otf} \xetex needs the path or the complete filename. luatex has it's own font database, which finds all fonts.
    – user187802
    Commented Oct 1, 2022 at 18:32
3

The mathpazo package is quite old. It hasn't been updated in years, and hence it's no real surprise that's it's not particularly usable under either XeLaTeX or LuaLaTeX.

Fortunately, the much newer and well-maintained newpxtext and newpxmath font packages provide Palatino clone text and math fonts that can be used equally well under pdfLaTeX, XeLaTeX, and LuaLaTeX. To wit, the following code produces the exact same output under all three engines.

enter image description here

\documentclass{article} % or some other suitable document class
\usepackage{iftex}      % test which TeX engine is in use
\iftutex % 'true' if either XeTeX or LuaTeX is in use
  \usepackage[no-math]{fontspec}
\fi
\usepackage[osf]{newpxtext} % oldstyle numerals as default in text mode
\usepackage{newpxmath}

\begin{document}
Hello 123 \liningnums{123} $123 \sum\int\prod \displaystyle \sum\int\prod$ 
\end{document}
4
  • Thanks. This works. Except that I don't really care for the Palatino font (in specific the quote marks). Is there any way to change it to a different font?
    – JRCSalter
    Commented Oct 3, 2022 at 20:24
  • @JRCSalter - Short answer: Yes. Any longer answer will depend critically on which font, or fonts, you're interested in. Is it an Opentype font? Do you need the text and math fonts to harmonize? Do you even use math in your document? BTW, my mind-reading skills are sadly absolutely worthless. A side-effect of this sorry situation is that I'm no good at all at guessing your needs and objectives; you'll have to articulate them yourself.
    – Mico
    Commented Oct 3, 2022 at 21:06
  • Sorry, but I didn't realise there was anything more complex than just changing the font; I didn't realise that there was anything special about math fonts (which I'm not concerned with). I don't know what font I need, but how does that matter? Can't I just find a font, and enter a command to use it?
    – JRCSalter
    Commented Oct 3, 2022 at 21:12
  • @JRCSalter - Various fonts require various loading mechanisms. For many it's as simple as executing one or more \usepackage statements. (Cf. \usepackage[osf]{mathpazo}.) For other fonts, especially many Opentype fonts, it's necessary to load the fontspec package and to issue suitably chosen \setmainfont, \setsansfont, and/or\setmonofont directives. There are tens of thousands, if not hundreds of thousands, of fonts out there. Since you say you don't know which font you need, may I suggest that you settle this issue first before you ask how you might load the font of your choice?
    – Mico
    Commented Oct 3, 2022 at 21:29

You must log in to answer this question.

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