1
\documentclass[14pt]{memoir}

\begin{document}
Convert
\[ 0123456789 \]
To
\[ \mathsf{0123456789} \]
\end{document}

enter image description here

Mico
  • 506,678
mohammed
  • 151
  • I've taken the liberty of making the code in your query truly minimal. Feel free to revert. – Mico Apr 02 '20 at 23:37
  • 1
    Request clarification: What about numbers in text; what about variables and functions in math? – Donald Arseneau Apr 03 '20 at 01:44
  • 1
    The questions is not really clear, but I guess you want to do this: https://tex.stackexchange.com/questions/174021/typeset-whole-document-in-sans-serif-including-math-mode – Henri Menke Apr 03 '20 at 04:14

1 Answers1

2

I'm interpreting your request as follows: You want the numerals 0 through 9 to be rendered using a sans-serif style if and only if these numerals occur in math mode.

If this interpretation is a correct, a minimal modification of @egreg's answer to an earlier query of yours will do the job:

enter image description here

\documentclass[14pt]{memoir}

\DeclareSymbolFont{sansletters}{\encodingdefault}{\sfdefault}{m}{n}
\SetSymbolFont{sansletters}{bold}{\encodingdefault}{\sfdefault}{bx}{n}
\DeclareSymbolFontAlphabet{\mathsf}{sansletters}

\DeclareMathSymbol{0}{\mathalpha}{sansletters}{`0}
\DeclareMathSymbol{1}{\mathalpha}{sansletters}{`1}
\DeclareMathSymbol{2}{\mathalpha}{sansletters}{`2}
\DeclareMathSymbol{3}{\mathalpha}{sansletters}{`3}
\DeclareMathSymbol{4}{\mathalpha}{sansletters}{`4}
\DeclareMathSymbol{5}{\mathalpha}{sansletters}{`5}
\DeclareMathSymbol{6}{\mathalpha}{sansletters}{`6}
\DeclareMathSymbol{7}{\mathalpha}{sansletters}{`7}
\DeclareMathSymbol{8}{\mathalpha}{sansletters}{`8}
\DeclareMathSymbol{9}{\mathalpha}{sansletters}{`9}

\begin{document}
0123456789 vs.\ $0123456789ABC$
\end{document}
Mico
  • 506,678