# Selective lining figures with KPFonts

I'm writing a document that uses OSF with KPFonts. However, they look a bit awkward within tables. Is there a way of switching to lining figures locally with KPFonts?

• Use math mode for the numbers. – egreg Sep 30 '13 at 20:38
• @egreg The problem is that it gives my CM figures, rather than lining KPFont figures. – NVaughan Oct 1 '13 at 0:28

Using math mode for numeric columns should work; however, if you really want that all tabular environments use lining figures, you can do a trick:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[oldstyle]{kpfonts}
\usepackage{array}
\usepackage{etoolbox}
\begin{document}
Numbers: 1234; numbers in math: $1234$

A tabular, first column text, second column math

\begin{tabular}{l>{$}l<{$}}
123 & 123 \\
456 & 456
\end{tabular}

\preto\tabular{\fontfamily{jkp}\selectfont}

A tabular, first column text, second column math

\begin{tabular}{l>{$}l<{$}}
123 & 123 \\
456 & 456
\end{tabular}

\end{document}


As you see, in the second table both columns are equal. If you prefer not having to choose math mode (which might be a nuisance), add the line

\preto\tabular{\fontfamily{jkp}\selectfont}


to your preamble. Remember to \usepackage{etoolbox}.

• Thanks. What's the use of having etoolbox here? – NVaughan Oct 1 '13 at 17:08
• Oh, OK, I just didn't know about the \preto command! – NVaughan Oct 1 '13 at 17:12

Not quite sure why this works (i.e. why it doesn't mess my smallcaps etc. up):

\fontfamily{jkp}\selectfont