Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

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}
share|improve this answer
    
Worked perfectly, thanks! –  Ben Dec 21 '10 at 14:26
add comment

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}
share|improve this answer
    
Unfortunately that didn't work. I am using a proprietary Garamond from my university which is invoked by \renewcommand{\rmdefault}{pad}. –  Ben Dec 14 '10 at 20:05
    
Specify that after loading mathdesign. I extended my answer. –  Stefan Kottwitz Dec 14 '10 at 20:31
    
That still gives me an error. (file ugmmi8a.pfb): cannot open Type 1 font file for reading –  Ben Dec 16 '10 at 10:26
    
@Ben: ugmmi8a.pfb belongs to the urw-garamond package, you need to install that for mathdesign-garamond, even if you later switch to pad. –  Stefan Kottwitz Dec 16 '10 at 12:41
    
OK, but that did not give me the desired result, for one, the characters 0...9 are now typeset in the new Garamond, not 'pad'. Worse, all mathematics symbols are now typeset in Garamond. –  Ben Dec 21 '10 at 14:07
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.