From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/39846 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: luatex feature question/request Date: Fri, 4 Apr 2008 15:48:24 -0400 (EDT) Message-ID: References: <20080404050924.GA21356@atos.labs.wmid.amu.edu.pl> <47F5DDDF.9040304@wxs.nl> <47F5E7D3.407@elvenkind.com> <47F5EC67.9020903@elvenkind.com> <20080404192659.GA5994@gaston.couberia.bzh> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-1988594644-1207338505=:11038" X-Trace: ger.gmane.org 1207338584 12530 80.91.229.12 (4 Apr 2008 19:49:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Apr 2008 19:49:44 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Apr 04 21:50:15 2008 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1JhrvR-0004fy-VQ for gctc-ntg-context-518@m.gmane.org; Fri, 04 Apr 2008 21:50:14 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5D66F1FC14; Fri, 4 Apr 2008 21:49:35 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 18900-01-2; Fri, 4 Apr 2008 21:48:53 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id B99B71FBCB; Fri, 4 Apr 2008 21:48:53 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 928D81FC03 for ; Fri, 4 Apr 2008 21:48:52 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17052-02-21 for ; Fri, 4 Apr 2008 21:48:15 +0200 (CEST) Original-Received: from tombraider.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.93.161]) by ronja.ntg.nl (Postfix) with ESMTP id 7AF301FBBE for ; Fri, 4 Apr 2008 21:48:15 +0200 (CEST) Original-Received: FROM udhcp-wlan66.public.engin.umich.edu (udhcp-wlan66.public.engin.umich.edu [141.213.120.76]) BY tombraider.mr.itd.umich.edu ID 47F685FB.E5C0A.10307 ; 4 Apr 2008 15:48:12 -0400 In-Reply-To: <20080404192659.GA5994@gaston.couberia.bzh> User-Agent: Alpine 1.00 (DEB 882 2007-12-20) X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:39846 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1988594644-1207338505=:11038 Content-Type: TEXT/PLAIN; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Fri, 4 Apr 2008, Peter M=FCnster wrote: > On Fri, Apr 04 2008, Taco Hoekwater wrote: >> >> % engine=3Dluatex >> >> \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 =3D 2~$ into $a~=3D~2~$, and "\TEX is" into "\TEX~is". > > Hello, > > Perhaps this one could be already useable for the OP: > > function add_ties(line) > =09line =3D line:gsub('( %a) ', '%1~') > =09line =3D line:gsub('^(%a) ', '%1~') > =09line =3D line:gsub('( %a)$', '%1~%%') > =09return line > end > > Not working: $a =3D b + c$. How about substituting with a macro \nonbreakbablespace (instead of ~) and= =20 redefining \nonbreakablespace to \relax using \everymathematics or=20 \mathortext? Aditya --8323329-1988594644-1207338505=:11038 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --8323329-1988594644-1207338505=:11038--