[XeTeX] sting manipulation macros

Ross Moore ross at ics.mq.edu.au
Sun Oct 19 20:32:05 CEST 2008

On 20/10/2008, at 3:42 AM, Michiel Kamermans wrote:

> caapv 208 wrote:
>> --- Michiel Kamermans <pomax at nihongoresources.com> wrote:
>>> I needed to compare individual glyphs in sections of
>>> text to unicode
>>> block start and end markers, so that I could insert
>>> tex macros between
>>> characters of different unicode blocks (if the font
>>> definitions for
>>> those blocks were different).

> For this, the currently available functionality isn't good enough by
> far, and an almost trivial addition to the engine would allow for more
> control by the user (which is why we all use TeX in the first place)
> while offering great enrichment to what we can do in macros because we
> can perform conditional logic based on the properties of individual
> characters.

It sounds like TeX's pattern-matching, and \ifx conditional,
and other primitives such as \futurelet, are just what you want.

Several LaTeX packages rely on per-character parsing, to decide
what to do with specific kinds of data. Examine the internal
coding of these packages to see how they work.
Off the top of my head I can think of:

   hyperref.sty   converting the input stream to PDF strings
      e.g. for Bookmarks and other PDF elements;

   Xy-pic  is full of parsers that interpret character strings
           as programming code to include graphic elements.

      and similar packages, need this kind of processing.

> - Mike

Hope this helps,


Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114

More information about the XeTeX mailing list