[XeTeX] linux libertine and number

Philip Taylor (Webmaster, Ret'd) P.Taylor at Rhul.Ac.Uk
Thu Dec 30 19:51:22 CET 2010



Ulrike Fischer wrote:

> It is a very bad idea to make numbers active and to define them in
> this way.

By way of demonstration that one can make digits active yet
still have access to the functionality that François needs,
I append the following :

** Phil.
--------
\documentclass {minimal}
\usepackage {longtable}
\usepackage {fontspec}
\setmainfont {Linux Libertine O}

\def \makedigitsactive
      {
	\makedigitactive 0
        	\makedigitactive 1
        	\makedigitactive 3
        	\makedigitactive 4
        	\makedigitactive 5
        	\makedigitactive 6
        	\makedigitactive 7
        	\makedigitactive 8
        	\makedigitactive 9
      }

\def \makedigitactive #1%
      {
        	\catcode `#1 = \active
	\uccode `\~ = `#1		
	\uppercase {\def ~}{\ifmmode \string #1\else $#1$\fi}
      }

\begin {document}

\begin {longtable}{ccccc}
   \hline %
   \multicolumn {2}{|c||}{1\textsuperscript {st} step} &
   \multicolumn {1}{c}{} & \multicolumn {2}{||c|}{2\textsuperscript {nd}
     step}\\\hline \hline
   \rule {0pt}{15pt}1 & & 1 & $1\times 35 + 5 =$ & 40\\
   7 & $7\times 5 + 0 =$ & 35 & & 35\\
   5 & & 5 & & \\
   0 & & & &
\end {longtable}

\def \zero {0}
\def \one  {1}
\def \five {5}

\makedigitsactive

\begin {longtable}{ccccc}
   \hline %
   \multicolumn {2}{|c||}{1\textsuperscript {st} step} &
   \multicolumn {\one}{c}{} & \multicolumn {2}{||c|}{2\textsuperscript {nd}
     step}\\\hline \hline
   \rule {\zero pt}{\one \five pt}1 & & 1 & $1\times 35 + 5 =$ & 40\\
   7 & $7\times 5 + 0 =$ & 35 & & 35\\
   5 & & 5 & & \\
   0 & & & &
\end {longtable}

\end {document}


More information about the XeTeX mailing list