# [texhax] Question about math fonts in LaTeX

Uwe Lueck uwe.lueck at web.de
Thu Jan 20 15:18:47 CET 2011

"Vafa Khalighi" <vafakhlgh at gmail.com>, 20.01.2011 14:41:15:
> Can you change the font of \mathbf so that the font of only digits
> changes and everything else will be typeset in the default font.
> For  example, say your default font for \mathbf is cmr but you
> only want to  change the font of digits inside \mathbf to cmtt and
> nothing else so  that $\mathbf{xyz0123}$ give you xyz in cmr
> but 0123 in cmtt. Is  this doable?
> (of course without creating a new font or modifying an existing font)

I think the coolstr package

http://ctan.org/pkg/coolstr

can tell "numeric strings" from others, so you could redefine
\mathbf to analyze the characters and then apply font commands
accordingly.

HTH -- Uwe.