From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/64555 Path: news.gmane.org!not-for-mail From: "Thomas A. Schmitz" Newsgroups: gmane.comp.tex.context Subject: Re: Marginal line numbers Date: Thu, 16 Dec 2010 08:34:37 +0100 Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1292484908 1958 80.91.229.12 (16 Dec 2010 07:35:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 16 Dec 2010 07:35:08 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Dec 16 08:35:04 2010 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 1PT8Mh-0007Ld-BN for gctc-ntg-context-518@m.gmane.org; Thu, 16 Dec 2010 08:35:03 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 4A04DCA88B; Thu, 16 Dec 2010 08:35:02 +0100 (CET) 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 7bMTEUsP6Az0; Thu, 16 Dec 2010 08:34:59 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 1CCFBCA90C; Thu, 16 Dec 2010 08:34:59 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 34D95CA90D for ; Thu, 16 Dec 2010 08:34:57 +0100 (CET) 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 OBRvSH6-zaTv for ; Thu, 16 Dec 2010 08:34:55 +0100 (CET) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id E8337CA90A for ; Thu, 16 Dec 2010 08:34:54 +0100 (CET) Original-Received: from uni-bonn.de (mail.uni-bonn.de [131.220.15.113]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id oBG7YrCn009381 for ; Thu, 16 Dec 2010 08:34:54 +0100 Original-Received: from [88.128.91.151] (account tschmit1@uni-bonn.de HELO [10.142.12.247]) by fe2.uni-bonn.de (CommuniGate Pro SMTP 5.2.12) with ESMTPA id 51639875 for ntg-context@ntg.nl; Thu, 16 Dec 2010 08:34:53 +0100 In-Reply-To: X-Mailer: Apple Mail (2.1082) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=131.220.15.113; country=DE; region=07; city=Bonn; latitude=50.7333; longitude=7.1000; http://maps.google.com/maps?q=50.7333,7.1000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0cDHHySge - 1c0bbf9a3514 - 20101216 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.71 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:64555 Archived-At: On Dec 14, 2010, at 9:33 PM, Jon Crump wrote: > All, > > Thanks to Thomas's help, I've been making my way up the learning curve. > > My TEI xml has empty lb elements indicating lines in the original and > corresponding lb elements in the translation. I'd like to be able to > set these numbers in the margin so that readers may coordinate the > lineation. So far I have this: > > \startxmlsetups xml:lb > \lineNumbers{\xmlatt{#1}{n}} > \xmlflush{#1} > \stopxmlsetups > > \defineinmargin [lineNumbers] [outer] [normal] > > which works, but I'd like to be able to set only every fifth or tenth > line number. Is there a way to perform some arithmetic on the value of > the n attribute and then execute \lineNumbers accordingly? > > for example: > > if n%5 == 0 then \lineNumbers else ignore > > Thanks, > Jon This is easy with a lua function. Since you know python, I guess the following example will be easy for you: \startluacode function filter(s) if math.mod(s,5) == 0 then context.color( { "darkred" }, s ) else context.color( { "darkblue" }, s ) end end \stopluacode \define[1]\MyNumber% {\ctxlua{filter(#1)}\endgraf} \starttext \dorecurse{25}{\MyNumber{\recurselevel}} \stoptext This should get you going, I hope Good luck Thomas ___________________________________________________________________________________ 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 ___________________________________________________________________________________