quail: TeX input method: change UTF8 to tex and back: solution & problems

Aidan Kehoe kehoea at parhasard.net
Mon Jan 7 07:38:40 EST 2008


 Ar an seachtú lá de mí Eanair, scríobh Uwe Brauer: 

 > Anyhow the code worked, but there is a problem:
 > 
 > (defvar tex2utf8symb-trans-tab
 >   '(
 > 	("\\in" "∈")
 > 	("\\infty" "∞")
 > 	("\\int" "∫")
 > 
 > ))
 > 
 > While 
 > \in and \int are transformed correctly 
 > \infty is changed to ∈fty, 
 > 
 > which is wrong (on the other hand I don't understand why 
 > \int is not transformed to ∈t but anyhow).
 > 
 > So the question is how shall I define the tex commands uniquely?

What you need to do is rewrite the code to use #'posix-search-forward, which
guarantees that it will return the longest match (that is, it will always
try to match "\\infty" if possible, and only then look for "\in".) You might
also want to look into the #'regexp-opt function, which, given a list of
strings, returns a theoretically fast regexp to match that list--you’ll need
the regexp to pass to posix-search-forward. (I’m not however certain if
regexp-opt interacts well with posix-search-forward; anyone else know?)

-- 
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?



More information about the XEmacs-Beta mailing list