[XeTeX] Trying to format fractions

Stephen Moye stephenmoye at mac.com
Tue Oct 6 19:00:46 CEST 2009


I'm trying to find some way of minimally marking up a text that  
contains a lot of fractions. I thought that \XeTeXinterchartoks might  
come to the rescue. Something like:

%%=====%%

% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = xetex

\XeTeXinterchartokenstate = 1

\XeTeXcharclass `\1 7
\XeTeXcharclass `\2 7
\XeTeXcharclass `\3 7

\def\makefrac#1/#2{#1yy#2}

\XeTeXinterchartoks 255 7 = {\makefrac}

test 1/2 more

\bye

%%=====%%

This is plain TeX sample for simplicity's sake, and the definition of  
\makefrac will be changed to make the appropriate font call.

The problem arises, as has been discussed before, that the frac OT  
feature turns on the feature for all numbers, not just those  
surrounding a slash. As all of the fractions are preceded by spaces, I  
thought that the above might work. It does not. It gives this fairly  
unexpected (to me, that is) error:

! Paragraph ended before \makefrac was complete.
<to be read again>
                    \par
l.15

What am I doing wrong?

Thanks.

Stephen Moye
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20091006/48ce6bd2/attachment.html>


More information about the XeTeX mailing list