Am 20.06.2011 00:03, schrieb Peter Baker:
It seems to me (having worked with OpenType fonts for some years) that
while it might be possible to make an Arabic-->Roman converter at the
font level, that's going to be one of the most inefficient possible ways
to handle it.

Then why is Unicode proposing / imposing it that way?

 With OT you can make a set of rules that says

Here's a 1 followed by two digits; substitute a C;
Here's a 2 followed by one digit; substitute XX
Here's a 3 followed by a something other than a digit; substitute III.

But it can't understand numbers the way a programming language can do.

Does it have to? I thought arabic->roman to merely be a (somewhat complex) substitution of glyphs.

If you want to be able to write XC for 90, the task gets somewhat more
complex, because OT definitely can't say

For a number in the range 90-99, do the following . . .

9 followed by  one digit: substitute XC
9 followed by two digits: substitute CM
9 followed by something other than a digit: IX
(9 followed by three digits: MMMMMMMMM)


Surely a programmatic solution would be better; and (La)TeX has an
understanding of roman numbers built in. With a little Googling I was
able to come up with this file, which works:

%&program=xelatex
%&encoding=UTF-8 Unicode

\documentclass[11pt,letterpaper,twoside,openany]{book}

\usepackage{fontspec}

\makeatletter
\newcommand{\rmnum}[1]{\romannumeral #1}
\newcommand{\Rmnum}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother

\begin{document}

There are \rmnum{123}\ fish in the sea.

And there are \Rmnum{5123}\ leaves on the tree.

\end{document}
That one uses letters to represent roman numerals. As was said before, that's not my intention, as roman numerals have a different meaning than letters.

But thanks for the macro recommendation. Until now, I only knew of \roman{counter}.


bye

Toscho


--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
 http://tug.org/mailman/listinfo/xetex

Reply via email to