On 07/01/2011, Philipp Stephani <[email protected]> wrote: > > BTW, you should _not_ do something like replacing ^c by ĉ. If you want ĉ, > type ĉ. Use a keyboard layout that contains that character, an input method, > or some auto-correction function of your text editor, but don't transform > text while processing. This is true no matter whether you write text files, > HTML, TeX, or whatever. Babel-like shorthands are completely obsoleted by > Unicode and cause more problems than they solve. >
Well, a far more robust approach seems to be using the lpeg library; I've recycled some code from a Lua script used for ConTeXt's transliteration for Greek, and then fed the Lua code to an ad hoc LaTeX command. The transliteration on the fly kinda works; but as warned by Philip, I've run into trouble because of one active char, namely, ~. I'm attaching the source code, all comments included, to document some attempts to process the conversion on the fly, to deal with the problematic active char, and to allow readers to compare with Hans Hagen's original mtx-babel.lua script. Please, beware this code may be roughly 2/3 cargo cult; so I'm not sure I can explain exactly how (or why) it works. Any feedback to help me handle this traumatic tilde are welcome. -- Luis Rivera O< http://www.asciiribbon.org/ campaign
lgr2utf.lua
Description: Binary data
lgrtrans.tex
Description: TeX document
