[XeTeX] changing font for numbers in math mode?

Ernest Adrogué eadrogue at gmx.net
Mon Jun 27 16:18:30 CEST 2011


Hi,

27/06/11 @ 08:32 (+0100), David Cottenden escriu:
> Greetings,
> 
> I'm not very expert - so don't quiz me overly - but my understanding
> is that setmathrm changes the maths roman font, whereas by default
> the maths digits are drawn from the normal maths font. You can
> change which font the digits are drawn from with:
> 
>   \DeclareMathSymbol{0}\mathalpha{operators}{"30}
>   \DeclareMathSymbol{1}\mathalpha{operators}{"31}
>   \DeclareMathSymbol{2}\mathalpha{operators}{"32}
>   \DeclareMathSymbol{3}\mathalpha{operators}{"33}
>   \DeclareMathSymbol{4}\mathalpha{operators}{"34}
>   \DeclareMathSymbol{5}\mathalpha{operators}{"35}
>   \DeclareMathSymbol{6}\mathalpha{operators}{"36}
>   \DeclareMathSymbol{7}\mathalpha{operators}{"37}
>   \DeclareMathSymbol{8}\mathalpha{operators}{"38}
>   \DeclareMathSymbol{9}\mathalpha{operators}{"39}
> 
> I've been using this for a year or two to replace Euler digits
> (which may have merits, but clearly don't match any text digits).

It doesn't seem to work in my computer.

The code below gives me different fonts in math and non-math mode
(fonts are quite similar, but it can be seen Charis SIL is thicker,
also the "9" is different).

\documentclass[12pt,a4paper]{article}
\usepackage[charter]{mathdesign}
\usepackage{fontspec}
\setmainfont[Scale=0.95]{Charis SIL}
\setmathrm{Charis SIL}
\DeclareMathSymbol{0}\mathalpha{operators}{"30}
\DeclareMathSymbol{1}\mathalpha{operators}{"31}
\DeclareMathSymbol{2}\mathalpha{operators}{"32}
\DeclareMathSymbol{3}\mathalpha{operators}{"33}
\DeclareMathSymbol{4}\mathalpha{operators}{"34}
\DeclareMathSymbol{5}\mathalpha{operators}{"35}
\DeclareMathSymbol{6}\mathalpha{operators}{"36}
\DeclareMathSymbol{7}\mathalpha{operators}{"37}
\DeclareMathSymbol{8}\mathalpha{operators}{"38}
\DeclareMathSymbol{9}\mathalpha{operators}{"39}
\begin{document}
\noindent
0123456789 \\
$0123456789$ \\
foo
$\mathrm{foo}$
\end{document}

I will keep trying...

-- 
Ernest


More information about the XeTeX mailing list