On Fri, Apr 04 2008, Taco Hoekwater wrote:
% 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".
Hello, Perhaps this one could be already useable for the OP: function add_ties(line) line = line:gsub('( %a) ', '%1~') line = line:gsub('^(%a) ', '%1~') line = line:gsub('( %a)$', '%1~%%') return line end Not working: $a = b + c$. Cheers, Peter -- http://pmrb.free.fr/contact/