[XeTeX] forcing counter evaluation
Michiel Kamermans
pomax at nihongoresources.com
Thu Oct 8 14:53:29 CEST 2009
I'm running into the problem of a counter not being expanded to its
actual value, leading xetex to complain that I'm using something that
isn't a number where a number is required.
In a nutshell, I am writing a new package that's fiddling with xetex'
interchartoks, and has the following macro command:
\usepackage{fontspec}
\newcommand{\lowestclass}{74}
\newcommand{\highestclass} {240}
...
\newcommand{\setUTransitionTo}[2]{
\newcounter{iclass}
\forloop{iclass}{\lowestclass}{\value{iclass} < #1}
{
\XeTeXinterchartoks #1 \value{iclass}={#2}
}
\forloop{iclass}{#1+1}{\value{iclass} <= \highestclass}}
{
\XeTeXinterchartoks #1 \value{iclass}={#2}
}
}
...
\setUTransitionTo{228}{\fontspec{Arial}}
problematically, the "\value{iclass}" command inside the for loops does
not yield the number stored in the counter, but yields the text string
"\c at iclass" instead, which is very much not what xetex expects to find
in a \XeTeXinterchartoks rule, so it dies.
I tried looking for ways to force counter evaluation, but the only
things I can find relating to forcing expansion are actually the "not
forcing expansion" commands (\expandafter, \noexpand, \the). Is there a
way to specify that \value needs to absolutely definitely give a number,
rather than the counter's macro? (I'm reading through TeX by Topic at
the moment, but it's not the easiest material to get through ^_^;;)
- Mike
More information about the XeTeX
mailing list