Q:

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?

A:

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}

