From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/74925 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Pablo_Rodr=EDguez?= Newsgroups: gmane.comp.tex.context Subject: Re: is it possible to have first and last line numbers from page? Date: Tue, 06 Mar 2012 20:16:31 +0100 Message-ID: <4F56628F.2050308@web.de> References: <4F534200.3040003@web.de> <7EE03A1D-A4BA-4AB1-BD98-7075F300C85D@googlemail.com> <4F535CCC.2030902@web.de> <4F564A53.5070503@web.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1331061426 28399 80.91.229.3 (6 Mar 2012 19:17:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Mar 2012 19:17:06 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Mar 06 20:17:03 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S4zsZ-0003dD-6Y for gctc-ntg-context-518@m.gmane.org; Tue, 06 Mar 2012 20:16:59 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 52BA1CB248; Tue, 6 Mar 2012 20:16:58 +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 qa6rZ5n0bEgW; Tue, 6 Mar 2012 20:16:52 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 7D813CABBD; Tue, 6 Mar 2012 20:16:52 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0F620CABBD for ; Tue, 6 Mar 2012 20:16:51 +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 o4YnH0S9yIGA for ; Tue, 6 Mar 2012 20:16:36 +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 D2A39CAB03 for ; Tue, 6 Mar 2012 20:16:36 +0100 (CET) Original-Received: from fmmailgate06.web.de (fmmailgate06.web.de [217.72.192.247]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id q26JGa8w019338 for ; Tue, 6 Mar 2012 20:16:36 +0100 Original-Received: from moweb002.kundenserver.de (moweb002.kundenserver.de [172.19.20.108]) by fmmailgate06.web.de (Postfix) with ESMTP id E73B1DE6BF9 for ; Tue, 6 Mar 2012 20:16:35 +0100 (CET) Original-Received: from [192.168.1.33] ([88.7.24.47]) by smtp.web.de (mrweb001) with ESMTPA (Nemesis) id 0LZvw5-1SoUBC1fbR-00lcDh; Tue, 06 Mar 2012 20:16:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 In-Reply-To: X-Provags-ID: V02:K0:1HX9BM4iXFxZvdoROmI1HoliZzth9DyXYv5Wb1F2eEb EFIuIPKUvmmpWiFF+gYbg74htQn7cUEAcYkJp8A2ePWoMiMZw1 ltU/33l5snDz9Mb2NUBnxVAB/HF0Y0okAmtJpt+4LIw2dLDhMo vS3VE87gE2mjjxOySBOCQA6YYQFCBubhYqy8v5NGR6aMxnWm2x yoflKeS9XZIAf1EehzmWw== X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=217.72.192.247; country=DE; latitude=51.0000; longitude=9.0000; http://maps.google.com/maps?q=51.0000,9.0000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0LGGjgAf1 - 04fe560522bc - 20120306 (trained as not-spam) 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:74925 Archived-At: On 06/03/12 19:48, luigi scarso wrote: > 2012/3/6 Pablo Rodr=EDguez > = > Luigi, I'm afraid it doesn't work as expected in the real file > = > I'm not surprised.... = My fault, because I didn' realize that numbers only appeared on each fifth line. > Lines are numbered there with [step=3D5]. So I get in headers only > actually numbered lines, although it header should contain the real l= ine > numbers (even with the line number isn't shown on that line). > = > How would it the the code in that case? (Sorry for asking this, but I= 'm > afraid I cannot code in lua [or in any other language].) > = > Do you have an example ? Adapting from your code: \startluacode document.my_name_space =3D document.my_name_space or {} document.my_name_space.pages =3D document.my_name_space.pages or {} local f =3D io.open(file.addsuffix(tex.jobname,"tuc") ) print('>>>>> ',f) if f=3D=3Dnil then --[=3D[ do nothin ]=3D] else f:close() local tuc =3D dofile(file.addsuffix(tex.jobname,"tuc")) local data =3D tuc.structures.references.collected[""] local w local pages =3D document.my_name_space.pages local realpage,ref for k, v in pairs(data) do w=3Dstring.gmatch(k,'LIN:(\%d+):\%d+') ref =3D tonumber(w()) realpage =3D tostring(v.references.realpage) pages[realpage]=3D pages[realpage] or {} table.insert(pages[realpage],ref) end for page,array in pairs(pages) do table.sort(array) end end \stopluacode \definemarking[linenumber] \define\LinenumberCommand {\normalexpanded{\setmarking[linenumber]{\linenumber}}\pagereference[LIN:\= linenumber:\currentpage]} \setuplinenumbering[command=3D\LinenumberCommand,step=3D5] \startsetups linenumber \startluacode local l=3D0; if document.my_name_space =3D=3D nil then return end; if document.my_name_space.pages =3D=3D nil then return end; local pages =3D document.my_name_space.pages; for _,_ in pairs(pages) do l=3Dl+1 end; if l=3D=3D 0 then return end; --[=3D[ OK, we have some data to print ]=3D] local array =3D pages[tostring(tex.count.realpageno)] l=3D0; if array =3D=3Dnil then return end; for _,_ in pairs(array) do l=3Dl+1 end; if l>0 then context(array[1].." -- "..array[l]) end; \stopluacode \stopsetups \setupheadertexts[\texsetup{linenumber}] \starttext \dorecurse{6}{\input tufte\par} \startlinenumbering \dorecurse{20}{\input knuth\par} \stoplinenumbering \startlinenumbering \dorecurse{20}{\input knuth\par} \stoplinenumbering \stoptext On page 7 lines are numbered from lowest to highest values. A purist might consider this wrong, but this is unlikely to happen on a real book, since (I guess) line numbers on headers only make sense when they two different series cannot be on the same page. Many thanks for your help, Pablo -- = http://www.ousia.tk ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________