[XeTeX] linux libertine and number

Philip Taylor (Webmaster, Ret'd) P.Taylor at Rhul.Ac.Uk
Tue Dec 28 20:08:57 CET 2010



François Patte wrote:

> Thanks for this answer. It is not too nice if you have to write:
>
> Multiply 5 by 7: $7\times 5 = 35$

Bonjour, François : is this perhaps the sort of
thing you had in mind ?

\documentclass {minimal}
\usepackage {fontspec}
\setmainfont {Linux Libertine O}
\begin {document}
Multiply 5 by 7: $7\times 5 = 35$

\catcode `\5 = \active
\catcode `\7 = \active
\def 5{\ifmmode \string 5 \else $5$\fi}
\def 7{\ifmmode \string 7 \else $7$\fi}
Multiply 5 by 7: $7\times 5 = 35$

\end {document}

Obviously you can \catcode and \def all digits
from zero to nine in a simple loop to cope with
the general case.

Philip TAYLOR


More information about the XeTeX mailing list