luigi scarso wrote:
There actually is a way to modify the input lines just before they are parsed by luatex, but that is really only suitable for converting 8-bit encodings to utf-8. (I was going to post an example abusing that method, but there are way many things that can go wrong, so I changed my mind) Post it anyway. We are all adults.
If you say so ... % engine=luatex \startluacode function add_ties (line) return line:gsub(' ','~') end \stopluacode \def\startfiltered {\ctxlua {callback.register('process_input_buffer', add_ties)}} \def\stopfiltered {\ctxlua {callback.register('process_input_buffer', nil)}} \starttext \startfiltered Thus, I came to the conclusion that the designer of a new system must not only be the implementer and first large||scale user; the designer should also write the first user manual. \stopfiltered \stoptext Notice how it breaks only at hyphens? If you think that is because those are the only valid breakpoints, you are actually slightly wrong: there are still 'normal' spaces between 'system' and 'must' and between 'the' and 'designer' (because EOL is converted to a space *after* reading in the line buffer). The lua function is _much_ too simple. It will happily convert '\ ' into '\~', $a = 2~$ into $a~=~2~$, and "\TEX is" into "\TEX~is". Best wishes, Taco