1

The cfr-lm package enables old style numerals for Latin Modern. It is based on the nfssext-cfr package that defines the \lnstyle macro switching back to lining numerals. Usually I switch to sans serif by using \renewcommand{\familydefault}{\sfdefault} but in this case the text affected by \lnstyle is not switched to sans serif.

\documentclass{article}
% \usepackage{nfssext-cfr} % defines \lnstyle, does not cause problems on its own
\usepackage{cfr-lm} % switches to Latin Modern with old style numerals
\renewcommand{\familydefault}{\sfdefault} % switch to sans serif
% \renewcommand{\lnstyle}{\fontfamily{clm2s}\selectfont} % hard coded fix    
\begin{document}
test 123 % sans serif old style numerals
\lnstyle test 123 % should be sans serif lining numerals
\end{document}

Is this behavior a bug or am I making a mistake?

3
  • Probably neither. \lnstyle is subtractive, like \regstyle, which the manual starts to explain as: "A - indicates that the macro will attempt to subtract from the current font’s family name, series or shape." What that means, I don't know enough yet. The package works cumulatively on font features, so it would be worthwhile noticing also: "The actual effect of any macro depends on any changes made to the defaults for various font features, the current font and, of course, what is available." \lnstyle works at the font family level, as I understand. Unrelated: why not use \osstyle?
    – Cicada
    Jan 28, 2021 at 12:45
  • Thanks to your comment I have notices that there is a second lining figures macro \lstyle. This one seems to do what I am looking for. But honestly I have trouble understanding the difference between these two commands.
    – Jan Hajer
    Jan 28, 2021 at 16:58
  • Note that, if you can use fontspec, it supports \liningnums and \oldstylenums commands that invoke the OpenType font features.
    – Davislor
    Jan 30, 2021 at 3:11

1 Answer 1

1

A picture may help.

fonts

And that's just the \rmfamily upright shape. Bold, italics, bolditalics, small caps. Multiply by \sffamily and \ttfamily... And not all font features are going to exist in all permutations, so the "nearest" one is searched for...

This is the tip-of-the-iceberg of the complexity required when dealing with the old 7-bit and 8-bit fonts.

As I understand it, in the legacy-font world, to activate a font feature or deactivate one, the nfssext-cfr package employs a set of switches which cumulatively add to, or subtract from, what was previously switched on/off upstream. So the effect of a switch depends heavily on the context.

The package assumes (1) that the font files are named using the Berry scheme; (2) that NFSS letter codes are being used, like j and 2 in the illustration; and (3) that the default font settings have not been re-defined.

MWE

\documentclass{article}
\usepackage{cfr-lm} % calls nfssext-cfr
\newcommand\testtext{123,456,789 \fontname\font }

\begin{document}
%=======================
\begin{tabular}{lll}
Setting & Sample + font used & Code\\
\hline Package Default & \testtext& \\
+j & \ostyle\testtext& \verb|\ostyle|\\
-j & \lstyle\testtext& \verb|\lstyle|\\
+2 & \pstyle\testtext& \verb|\pstyle|\\
-2 & \tstyle\testtext& \verb|\tstyle|\\
+j+2 & \postyle\testtext& \verb|\postyle|\\
-j-2 & \tlstyle\testtext& \verb|\tlstyle|\\
+j-2 & \tostyle\testtext& \verb|\tostyle|\\
-j+2 & \plstyle\testtext& \verb|\plstyle|\\
No style & \regstyle\testtext& \verb|\regstyle|\\
No style +j & \regstyle\ostyle\testtext& \verb|\regstyle\ostyle|\\
No style +2 & \regstyle\pstyle\testtext& \verb|\regstyle\pstyle|\\
\end{tabular}

\end{document}

ADDED

The following MWE shows the three font families, in normal, bold, bolditalics, italics, small caps, and small caps bold; and the nearest font selected where the font feature was not available.

MWE

\documentclass{article}
\usepackage{cfr-lm} % calls nfssext-cfr
\newcommand\testtext{123,456,789 \fontname\font }
\newcommand\tv[1]{\regstyle\normalfont\texttt{\textbackslash #1}}
\newcommand\thesample[1]{%
\noindent #1

\begin{tabular}{lll}
Setting & Sample + font used & Code\\
\hline Package Default & \testtext& \\
+j & \ostyle\testtext& \tv{ostyle}\\
-j & \lstyle\testtext& \tv{lstyle}\\
+2 & \pstyle\testtext& \tv{pstyle}\\
-2 & \tstyle\testtext& \tv{tstyle}\\
+j+2 & \postyle\testtext& \tv{postyle}\\
-j-2 & \tlstyle\testtext& \tv{tlstyle}\\
+j-2 & \tostyle\testtext& \tv{tostyle}\\
-j+2 & \plstyle\testtext& \tv{plstyle}\\
No style & \regstyle\testtext& \tv{regstyle}\\
No style +j & \regstyle\ostyle\testtext& \tv{regstyle}\tv{ostyle}\\
No style +2 & \regstyle\pstyle\testtext& \tv{regstyle}\tv{pstyle}\\
\end{tabular}
\par\bigskip
}
\begin{document}
%=======================
\rmfamily
\thesample{rmfamily normal}

\bfseries
\thesample{rmfamily bold}

\itshape
\thesample{rmfamily bold italics}


\mdseries
\thesample{rmfamily italics}

\upshape
\scshape
\thesample{rmfamily small caps}

\bfseries
\thesample{rmfamily small caps bold}
\upshape
\mdseries


%=======================
\sffamily
\thesample{sffamily normal}

\bfseries
\thesample{sffamily bold}

\itshape
\thesample{sffamily bold italics}


\mdseries
\thesample{sffamily italics}

\upshape
\scshape
\thesample{sffamily small caps}

\bfseries
\thesample{sffamily small caps bold}
\upshape
\mdseries



%=======================
\ttfamily
\thesample{ttfamily normal}

\bfseries
\thesample{ttfamily bold}

\itshape
\thesample{ttfamily bold italics}


\mdseries
\thesample{ttfamily italics}

\upshape
\scshape
\thesample{ttfamily small caps}

\bfseries
\thesample{ttfamily small caps bold}
\upshape
\mdseries


\end{document}

You must log in to answer this question.

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