%&latex \errorcontextlines=1000 \documentclass[a4paper]{article} \usepackage[cmoldstylemathdigits]{cmolddig} \makeatletter \renewcommand\section{\@startsection {section}{1}{\z@}% {-3.25ex\@plus -1ex \@minus -.2ex}% {1.5ex \@plus .2ex}% {\normalfont\bfseries}} \makeatother \newcommand{\testtext}{Some text numerals: 0123456789. Some maths numerals $0123456789$} \begin{document} \section{Default} \testtext \section{Both lining} {\cmliningdigits\cmliningmathdigits \testtext} \section{Text lining; maths default} {\cmliningdigits \testtext} \section{Text lining; maths oldstyle} {\cmliningdigits\cmoldstylemathdigits \testtext} \section{Text oldstyle; maths default} {\cmoldstyledigits \testtext} \section{Text oldstyle; maths oldstyle} {\cmoldstyledigits\cmoldstylemathdigits \testtext} \section{Text oldstyle; maths lining} {\cmoldstyledigits\cmliningmathdigits \testtext} \end{document}