[Tex/LaTex] Oldstyle numbers in body text computer modern

computer-modernoldstylenums

Is there any way to make all numbers written outside of math mode be rendered oldstyle while still using the Computer Modern font? I'm pretty partial to both, and also to not writing \oldstylenum every time I want one.
Using Latex, by the way.

Best Answer

You could load the cfr-lm package, i.e., write \usepackage{cfr-lm} in the preamble. If the package is loaded in this way, old-style numerals will be used in text mode and lining numerals will be used in math mode. Latin Modern is a clone of Computer Modern; the basic glyphs (those in the ASCII set) are essentially indistinguishable from Computer Modern; you'll notice big improvements in some glyphs with accents and diacritics when using Latin Modern.

To get lining numbers, use either math mode or the package's \textl macro.

enter image description here

\documentclass{article}
\usepackage{cfr-lm}
\begin{document}
\obeylines % just for this example
\textl{0123456789}
$0123456789$
0123456789
\textbf{0123456789}
\textit{0123456789}
\textbf{\textit{0123456789}}
\textsf{0123456789}
\texttt{0123456789}
\end{document}