4

My question is very similar to lining figures in tables and math, old style figures in text, except I am using the mathpazo font.

I would like to use text figures in the body (through usepackage[osf]{mathpazo}), but want to use lining figures for

  • equations
  • equation number in brackets
  • table of contents
  • page numbers
  • table and figure labels (e.g. the caption: "Fig 1.1: Comparison of ...", I would like "1.1" to use lining figures)
  • tables

For various reasons, I need to use pdftex.

How can I use mathpazo with these requirements? If you have typographical arguments against any of these points, please let me know!

A MWE with only text figures:

\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{amsmath, amsthm, amssymb}
\usepackage[osf]{mathpazo}

\begin{document}

\tableofcontents

\section{Old style numbers}
Old style numbers belong in text 0123456789. Not in in-line equations $\sqrt{4+x^2} = y$
Not in equations:
\begin{align}
    \min_{x,y} &\quad y^2 \\
    \mathrm{s.t} &\quad x > 4\\
        &\quad x < y^2
\end{align}
Nor in tables.

\begin{table}[!htb]
  \caption{mean, median and standard deviation}
  \label{tab:mean}%\libertineTabular
    \begin{tabular}{lccccr}
    \toprule
      climate & species & mean &  median & standard deviation & number of experiments \\
    \midrule
      1 & \textit{Picea abies}  & 20,3699   & 20,0335   & 4,453 & 30 \\
      2 & \textit{Picea abies}  & 23,9864   & 12,6398   & 7,236 & 98 \\
    \bottomrule
  \end{tabular}
\end{table}

\[ a^2 + b^2 = c^2 \qquad 1234567890 \]
Old style numbers belong in text 0123456789.

\section{New section}

\section{Newer section}

\section{Newest section}

\end{document}
Mico
  • 506,678
maero21
  • 588
  • I've taken the liberty of adding the memoir tag, as this document class has lots of specialized font-handling capabilities. – Mico Apr 20 '18 at 05:19
  • 1
    Are you free to use the newer newpxtext and newpxmath packages in lieu of the somewhat-ancient mathpazo package? – Mico Apr 20 '18 at 05:20
  • @Mico, the OP hasn't manifested themselves on your question. If I may intrude, I would like to hear about newpxtext and newpxmath in this context. – gusbrs Apr 20 '18 at 12:13
  • @gusbrs - Thanks. I'm still hoping that the OP will choose to address my questions. Let's give him/her a bit more time... – Mico Apr 20 '18 at 13:21
  • 2
    @Mico, in the meantime I found this https://tex.stackexchange.com/a/109960/105447. I asked because I've been fond of Palatino and clones for quite some time, but had dismissed newpx because I like oldstyle figures and the LaTeX Font Catalogue does not even suggest newpx includes them. So, thank you for pointing me to that! – gusbrs Apr 20 '18 at 13:26
  • If you’re updating your packages, I’d recommend unicode-math with Asana Math as the math font and Palatino (or TeX Gyre Pagella) as the text font, loaded with Numbers=OldStyle. You can then use the method in my answer to switch to lining fixed-width numbers in tables. – Davislor Apr 20 '18 at 20:08
  • If you’re sticking with legacy Type 1 fonts, don’t forget to call fontenc to set the text encoding to either T1 or LY1. Also a good idea to use microtype, which supports Palatino and its clones in both Type 1 and OpenType. – Davislor Apr 20 '18 at 20:10
  • @Mico, thanks for pointing that out. newpxtext and newpxmath are fine and work with my document – maero21 Apr 21 '18 at 09:51

1 Answers1

2

Your MWE already does old-style numerals in text and lining numerals in equations. That leaves your tables. Since mathpazo uses a Palatino clone as its text font, the easiest way to switch to lining numbers is to switch the font family to a Palatino clone with lining numbers, such as qplr for TeX Gyre Pagella.

If you’re using fontspec or unicode-math (Asana Math is a good OpenType replacement for mathpazo and you can use TeX Gyre Pagella as your matching text font, or you can keep using mathpazo with fontspec or mathspec), it gets even easier. You can get lining, tabular numbers with code like the following example from the fontspec manual:

{\addfontfeatures{Numbers={Monospaced,Lining}}
\begin{tabular}{@{} cccc @{}}
    Year & People & Miles & Boats \\
    \hline  1842 &  999   &  75   &  13   \\
    1923 &  111   &  54   &  56
\end{tabular}}

You can of course encapsulate either macro into something like \tnums or even a new table environment, to make it more semantic and less dependent on a specific package.

The fontspec package also adds both \oldstylenums and \liningnums commands that switch the OpenType font features of the currently-selected font.

Bear in mind that using different numerals for text mode and math mode makes it very obvious which mode you’re writing your numbers in. It’s not clear why these 4 cases is different from x = 4 or which one x equal to 4 should match. Most authors prefer to be consistent within the same document, or perhaps use old-style numerals in specific contexts such as headings or dates.

Davislor
  • 44,045
  • If the tables float memoir has a system to add thst font change to all floating tables. – daleif Apr 20 '18 at 06:33
  • @daleif Wasn’t aware of that. That’s convenient. – Davislor Apr 20 '18 at 11:11
  • 1
    See \setfloatadjustment in the memoir manual – daleif Apr 20 '18 at 11:27
  • Alternative: \newenvironment that wraps the table in a font change? Works in standard LaTeX. – Davislor Apr 20 '18 at 11:49
  • Yes, but bad programming style – daleif Apr 20 '18 at 11:56
  • @daleif You could also use the \newcolumntype or > commands of array and tabularx. redefine \tabularxcolumncommand for tabularx, or \LTpre of longtable. – Davislor Apr 20 '18 at 12:17
  • I would like to stick with pdflatex, so unfortunately using fontspec is off the table. Any way to do this without fontspec? – maero21 Apr 21 '18 at 09:59
  • @maero21 I’d suggest switching the font family to qplr (TeX Gyre Pagella) in the T1 encoding for tables or table columns containing numbers. Both Pagella and Pazo are clones of the same font, Hermann Zapf’s Palatino, so they’ll match. – Davislor Apr 21 '18 at 14:14
  • @Davislor Thanks for that. That gets the job done, but then the rest of the text in the table has an ever so slightly different font to the rest of the main text (as @Mico suggested, I am now using newpxtext and newpxmath). – maero21 Apr 22 '18 at 01:12
  • 1
    @Davislor with ppl it looks perfect, so I'll use that. Thanks! – maero21 Apr 22 '18 at 01:49