From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/69123 Path: news.gmane.org!not-for-mail From: luigi scarso Newsgroups: gmane.comp.tex.context Subject: Re: break strings Date: Mon, 13 Jun 2011 15:59:40 +0200 Message-ID: References: <81BCF9A8-D19A-4DD3-91EE-C552023AA86E@st.estfiles.de> <8EA8D5E8-2692-4D13-881A-4D8E499BF803@googlemail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1307973593 21913 80.91.229.12 (13 Jun 2011 13:59:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 13 Jun 2011 13:59:53 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Jun 13 15:59:49 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QW7gB-0002h0-U5 for gctc-ntg-context-518@m.gmane.org; Mon, 13 Jun 2011 15:59:48 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 952E7CADB0; Mon, 13 Jun 2011 15:59:47 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 4pXuGoe-N51p; Mon, 13 Jun 2011 15:59:47 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id C42BACADA1; Mon, 13 Jun 2011 15:59:44 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id EDF5ACADA1 for ; Mon, 13 Jun 2011 15:59:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id unE0pFU9Wg+E for ; Mon, 13 Jun 2011 15:59:42 +0200 (CEST) Original-Received: from filter1-ams.mf.surf.net (filter1-ams.mf.surf.net [192.87.102.69]) by balder.ntg.nl (Postfix) with ESMTP id 07B80CAD9E for ; Mon, 13 Jun 2011 15:59:41 +0200 (CEST) Original-Received: from mail-qw0-f41.google.com (mail-qw0-f41.google.com [209.85.216.41]) by filter1-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p5DDxemc029218 for ; Mon, 13 Jun 2011 15:59:41 +0200 Original-Received: by qwa26 with SMTP id 26so3057797qwa.14 for ; Mon, 13 Jun 2011 06:59:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=rJmBZVJYrOtwWHfaV1NjeIyuoRYqQqT7V++MywYXal0=; b=CmtAT41jCCfxiwu0ZSWIrtFfUQcx1K9tbTsylZ3mAYuwrp3DlH/o6CV6WCMLBaayW1 Lg0lxvct1VOPjGvpQQ0UgEvfUu9DSEui5NuUMSaMCMk8YcZDJHUQQrQ6UP1VqVasrzuC VMtBkBwKrE9sgHhdVldS6lCPy6b4FjKn5sPLA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=eraVtqyx+K7aPRgtijk4fHXlGRVjf+ekLF48DoJ9cbMLhKyuDWO32svNEuZ3y+/oJD jMo91Wuj/tv0n/fqJzmyaaREflzH7PRjnOYKozYBu409kcwRDlbT0gqUro4eoYqPeLsy i+LtJeB+usg3lQMVUKIaGQeup56uprOrvPuA0= Original-Received: by 10.229.126.129 with SMTP id c1mr3751679qcs.6.1307973580399; Mon, 13 Jun 2011 06:59:40 -0700 (PDT) Original-Received: by 10.229.247.7 with HTTP; Mon, 13 Jun 2011 06:59:40 -0700 (PDT) In-Reply-To: X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=209.85.216.41; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 06ETpXFlp - 22fde87b0cdc - 20110613 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.69 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:69123 Archived-At: On Mon, Jun 13, 2011 at 3:52 PM, Steffen Wolfrum wrote: >> Where is the difference ? >> >> \starttext >> >> >> \showframe >> >> \define[1]\ThisHelps {\handletokens#1\with{\hskip 0pt plus >> .1pt\firstofoneargument}} >> >> Test text test text\ThisHelps >> {9769387937933hhgiuiuziuziduzid93739837fhieuhifeuhfeiu39739837938398zfhfdkuhfiufhz398739837r98z379dihhfiu} >> >> \define[1]\ThisHelpsLuigi{% >> \startluacode >> s='#1' >> s= string.gsub(s,'(.)',"\%1\\hskip0sp") >> % maybe only some chars... >> %s= string.gsub(s,'[=/]',"\%1\\hskip0sp") >> context(s) >> \stopluacode} >> >> Test text test text\ThisHelpsLuigi >> {9769387937933hhgiuiuziuziduzid93739837fhieuhifeuhfeiu39739837938398zfhfdkuhfiufhz398739837r98z379dihhfiu} >> >> \stoptext > > > Just my "greenness" with luacode ... > > I didn't expect that it could be wrapped so easily in an handy \define command: > context(s) is wrapped in start/stopluacode is wrapped in \define[1]\LuigiHelps{...} The key point is % maybe only some chars... %s= string.gsub(s,'[=/]',"\%1\\hskip0sp") With '[=/]' you define a set of chars (only '=' and '/' in this example) so that only '=' => '=\hskip0sp' and '/' => '/\hskip0sp' i.e. breaks appear only on '=' and '/'. It' possible to define whatever char you want, but you must pay attention to '%' '#' etc. (as you do with \catcode) -- luigi ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________