ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Taco Hoekwater <taco@elvenkind.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: luatex feature question/request
Date: Fri, 04 Apr 2008 10:52:55 +0200	[thread overview]
Message-ID: <47F5EC67.9020903@elvenkind.com> (raw)
In-Reply-To: <fe8d59da0804040138v70f06428kd481c8c42eed6596@mail.gmail.com>



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


___________________________________________________________________________________
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	other threads:[~2008-04-04  8:52 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-04  5:09 Marcin Borkowski
2008-04-04  7:50 ` Hans Hagen
2008-04-04  8:33   ` Taco Hoekwater
2008-04-04  8:38     ` luigi scarso
2008-04-04  8:52       ` Taco Hoekwater [this message]
2008-04-04  8:58         ` Olivier Guéry
2008-04-04  9:08           ` Hans Hagen
2008-04-04 11:02             ` Olivier Guéry
2008-04-04 11:15               ` Wolfgang Schuster
2008-04-04 12:26                 ` Olivier Guéry
2008-04-04 12:55                   ` Peter Münster
2008-04-04 13:15                     ` Olivier Guéry
2008-04-04 15:15                       ` Peter Münster
2008-04-04 20:23                         ` Olivier Guéry
2008-04-04 12:26               ` Hans Hagen
2008-04-04 13:09                 ` Olivier Guéry
2008-04-15 19:18                   ` Hans Hagen
2008-04-15 19:54                     ` Olivier Guéry
2008-04-16  0:40                     ` Arthur Reutenauer
2008-04-16  8:50                       ` Hans Hagen
2008-04-16 10:19                         ` Olivier Guéry
2008-04-16 12:46                           ` Peter Münster
2008-04-16 14:20                             ` Hans Hagen
2008-04-04 10:16           ` Peter Münster
2008-04-04  9:19         ` luigi scarso
2008-04-04 19:26         ` Peter Münster
2008-04-04 19:48           ` Aditya Mahajan
2008-04-04 20:03             ` Peter Münster
2008-04-04 20:07             ` Hans Hagen
2008-04-04 20:20           ` Taco Hoekwater
2008-04-04  9:57   ` Marcin Borkowski
2008-07-04 10:54 Marcin Borkowski
2008-07-04 14:23 ` Idris Samawi Hamid ادريس سماوي حامد
2008-07-04 15:01   ` Olivier
2008-07-04 17:38     ` Idris Samawi Hamid ادريس سماوي حامد
2008-07-04 20:34       ` Hans Hagen
2008-07-04 20:39   ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47F5EC67.9020903@elvenkind.com \
    --to=taco@elvenkind.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).