Hi,

you totally misunderstood my intentions. I don't want to use neither Ⅰ, Ⅱ, Ⅲ, Ⅳ, … (u2160-u217f) nor I, II, III, IV, … (letters). I want to use something along "Henri {\fontchangingcommand 4} was a foobar king."

Is \fontspec capable of doing this?

bye

Toscho

Am 18.06.2011 12:51, schrieb enrico.grego...@univr.it:
Hi,

what is the preferred way of producing roman numerals as stylistic
alternatives (while still inputing arabic numerals)?  Unicode says, that
using the codepoints for roman numerals is deprecated and it seems fair
to me, as the meaning is the same.

\romand{<counter>} works of course, but that will probably
use letters.

You can try this:


%%% XeTeX code starts
\makeatletter
\def\UniRoman#1{\expandafter\@UniRoman\csname c@#1\endcsname}
\def\uniroman#1{\expandafter\@uniroman\csname c@#1\endcsname}

\def\@UniRoman#1{\ifcase#1\or
   Ⅰ\or Ⅱ\or Ⅲ\or Ⅳ\or Ⅴ\or Ⅵ\or Ⅶ\or Ⅷ\or Ⅸ\or Ⅹ\or Ⅺ\or Ⅻ\else
   \expandafter\@slowUniRoman\romannumeral #1@\fi}
\def\@slowUniRoman#1{\ifx @#1% then terminate
      \else
        \if i#1Ⅰ\else\if v#1Ⅴ\else\if x#1Ⅹ\else\if
        l#1Ⅼ\else\if c#1Ⅽ\else\if d#1Ⅾ\else \if
        m#1Ⅿ\else#1\fi\fi\fi\fi\fi\fi\fi
        \expandafter\@slowUniRoman
      \fi
}
\def\@uniroman#1{\ifcase#1\or
   ⅰ\or ⅱ\or ⅲ\or ⅳ\or ⅴ\or ⅵ\or ⅶ\or ⅷ\or ⅸ\or ⅹ\or ⅺ\or ⅻ\else
   \expandafter\@slowuniroman\romannumeral #1@\fi}
\def\@slowuniroman#1{\ifx @#1% then terminate
      \else
        \if i#1ⅰ\else\if v#1ⅴ\else\if x#1ⅹ\else\if
        l#1ⅼ\else\if c#1ⅽ\else\if d#1ⅾ\else \if
        m#1ⅿ\else#1\fi\fi\fi\fi\fi\fi\fi
        \expandafter\@slowuniroman
      \fi
}
\makeatother

\newcounter{cnta}
\renewcommand{\thecnta}{\uniroman{cnta}} % lowercase Roman numerals
\newcounter{cntb}
\renewcommand{\thecnta}{\UniRoman{cntb}} % uppercase Roman numerals
%%% XeTeX code ends

Since Unicode defines numerals from 1 to 12, I use those when the counter's 
value is in that range; otherwise I mimick the procedure for getting uppercase 
Roman numerals of the LaTeX kernel.

Ciao
Enrico

--
Enrico Gregorio          + Dipartimento di Informatica          + Tel: +39 045 
8027937
enrico.grego...@univr.it + Università degli Studi di Verona     +
(grego...@math.unipd.it) + Strada le Grazie 15 / I-37134 Verona + Fax: +39 045 
8027928



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

Reply via email to