10

I have a document in which the text is typeset in Garamond. The mathematics symbols are not typeset in Garamod, which is the way I like it. However, I would like the numbers 0...9 to be typeset in Garamond. How do I achieve this?

EDIT: I am emphasizing that I do not want all my mathematics in Garamond, only the digits 0...9

Ben
  • 2,609

2 Answers2

11

You can do it like this (replace phv by the name of your font):

\documentclass{article}
  \DeclareSymbolFont{numbers}{T1}{phv}{m}{n}
  \SetSymbolFont{numbers}{bold}{T1}{phv}{bx}{n}
  \DeclareMathSymbol{0}\mathalpha{numbers}{"30}
  \DeclareMathSymbol{1}\mathalpha{numbers}{"31}
  \DeclareMathSymbol{2}\mathalpha{numbers}{"32}
  \DeclareMathSymbol{3}\mathalpha{numbers}{"33}
  \DeclareMathSymbol{4}\mathalpha{numbers}{"34}
  \DeclareMathSymbol{5}\mathalpha{numbers}{"35}
  \DeclareMathSymbol{6}\mathalpha{numbers}{"36}
  \DeclareMathSymbol{7}\mathalpha{numbers}{"37}
  \DeclareMathSymbol{8}\mathalpha{numbers}{"38}
  \DeclareMathSymbol{9}\mathalpha{numbers}{"39}

\begin{document}
abc

$a=123$

\mathversion{bold}

$a=345$
\end{document}
Ulrike Fischer
  • 327,261
5

The font of single characters or symbols may be changed by \DeclareMathSymbol:

\DeclareSymbolFont{garamond}{T1}{pad}{m}{n}
\DeclareMathSymbol{1}{\mathord}{garamond}{`1}
\DeclareMathSymbol{2}{\mathord}{garamond}{`2}
...

For complete switching to Garamond, you could use mathdesign with garamond option:

\usepackage[T1]{fontenc}
\usepackage[garamond]{mathdesign}
% In the case of another commercial Garamond font like `pad` add afterwards:
\renewcommand{\familydefault}{pad}
\renewcommand{\rmdefault}{pad}
Stefan Kottwitz
  • 231,401