# How to create a “long-running” version of “\classicstylenums” in “kpfonts” package?

I'm using kpfonts in my document with old style numbers. However, in some sections (e.g. figures and tables), I want to revert to the normal style numbers. There is a command for doing that - \classicstylenums - but the text has to be given as an argument, like so: \classicstylenums{text text text text} Instead of having to repeat the command for each text segment, I want to declare it once, like so: \myclassicstylenums text text text ... And by doing it within a group, the text reverts back to old style numbers.

Anyone has any idea on how to achieve this?

-

You can revert to lined numbers by defining

\newcommand\linednumbers{%
\renewcommand{\rmdefault}{jkp}%
\renewcommand{\sfdefault}{jkpss}%
\normalfont}


This is a declaration that will respect grouping; so, for example, you can put it inside a table environment.

You can also use it as an environment by itself:

\begin{linednumbers}
Material with lined numbers
\end{linednumbers}


but it's best to use it for complete paragraphs.

If one is devious enough to use the fulloldstylenums option, then something more is needed:

\newcommand\linednumbers{%
\renewcommand{\rmdefault}{jkp}%
\renewcommand{\sfdefault}{jkpss}%
\normalfont\mathversion{lined}}
\DeclareMathVersion{lined}
\SetSymbolFont{operators}{lined}{OT1}{jkp}{m}{n}

-
I've noticed that this doesn't work for math mode. Could you augment your answer to include that as well? – gablin Jan 30 '12 at 13:41
@gablin See edited message; I wouldn't use fulloldstylenums except for reproducing very old books (but I don't think that the Kp fonts are suitable for this). – egreg Jan 30 '12 at 14:14
Ah damn, didn't realize that kpfonts had two separate options for old style numbers. That solved my problem! Thanks! – gablin Jan 31 '12 at 8:01