I am using mathsf{} in a command to mark special kinds of variables in a formula.
I have:
\newcommand{\mycmd}[1]{\mathsf{#1}}
In formulas I usually have
$\mycmd{specialvariable_1} = yada yada yada$
Now I noticed that the digits in the subscript are still printed in the serif font. This also happens for non-subscript numbers. A minimal example is:
$\mathsf{a5\,b_3}$
here the digits are printed in a serif font, the letters are printed in a sans-serif font.
How to force LaTeX to also print the digits in a sans-serif font?
(Maybe of interest: my command is often nested in other commands that occasionally are themselves nested in other commands...)
[Update]
As requested I made a minimal working example. It seems the package sansmath is the problem. Without the package, the digits are printed in sans-serif, with the package, the digits are printed with serifs. Nevertheless this seems a bit counterintuitve...
\documentclass[11pt]{scrbook}
\usepackage{sansmath}
\begin{document}
$\mathsf{a5\,b_3}$
\end{document}

\documentclass{...}and ending with\end{document}. – Apr 22 '14 at 09:33\showoutputthe log file will tell exactly which fonts are being used. In a standard article document, the digits inside\mathsfare taken fromcmss, the sans serif font, even when they are subscripts. – Andrew Swann Apr 22 '14 at 10:01sansmathdoes not redefine the\mathsfcommand. You just have to put\sansmathin the preamble and then all the maths in your document will use the sans fonts. – Thruston Apr 22 '14 at 11:16sansmath. – Thruston Apr 22 '14 at 11:17sansmathpackage and now it works as expected. If you post your comment as answer I will accept it as correct. – cpt. jazz Apr 22 '14 at 13:42