Arthur Reutenauer wrote:
>       Hello Idris,
> 
>   I didn't see any reply to this e-mail you sent two weeks ago, so I
> wanted to give it a try:
> 
>>          In luatex can I make a definition such that such that the string
>>
>> U004C U0303 (l ̃)
>>
>> is always treated as l with tilde above, taking into account italics and  
>> without using \~l (which does not work in, eg, footnote)?
> 
>   What you want here is to support the Unicode combining characters,
> which isn't straightforward in TeX because according to the Standard,
> they come after the base letter they modify, 

Which is a fairly annoying syntax for our purpose.

>     -- The following should check if we read ‘l’ and ‘combining tilde’
>     -- consecutively.  A lot of overhead; it would be much prettier to
>     -- implement a finite automaton :-)

Thanks for the reminder. We have been thinking about creating an
lpeg variant that operates on tokens and/or nodes instead of
simple data strings, but that will take quite a bit of work.

It would be possible to simplify the loop logic by storing 'v' in
a local variable, so that t[] always lags behind one value:

   function convert_combining(str)
     local l, t = { }, { }
     for _, v in ipairs(str) do
         if v[2] == 0x0303 and l[2] == 0x6c then
            t[#t+1] = token.create('buildtextaccent')
            t[#t+1] = token.create('texttilde')
         end
       if l[2] then t[#t+1] = l  end
       l = v
     end
     if l[2] then t[#t+1] = l  end
     return t
   end


Best wishes,
Taco
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to