From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/21449 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: how to number poetry? Date: Mon, 18 Jul 2005 15:44:37 +0200 Message-ID: <42DBB245.1000003@wxs.nl> References: <20050713205905.GA23919@localhost.localdomain> <6faad9f0050718051840eba60b@mail.gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1121694315 30518 80.91.229.2 (18 Jul 2005 13:45:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 18 Jul 2005 13:45:15 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Mon Jul 18 15:45:11 2005 Return-path: Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1DuVut-0005Ri-9y for gctc-ntg-context-518@m.gmane.org; Mon, 18 Jul 2005 15:44:19 +0200 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id C0D4512775; Mon, 18 Jul 2005 15:44:14 +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 07504-05; Mon, 18 Jul 2005 15:44:08 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 6F33912797; Mon, 18 Jul 2005 15:44:08 +0200 (CEST) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 2D95712797 for ; Mon, 18 Jul 2005 15:44:07 +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 07625-02 for ; Mon, 18 Jul 2005 15:44:06 +0200 (CEST) Original-Received: from mailrelay02.solcon.nl (maillb.solcon.nl [212.45.32.200]) by ronja.ntg.nl (Postfix) with ESMTP id 1618E12775 for ; Mon, 18 Jul 2005 15:44:05 +0200 (CEST) Original-Received: from server-1.pragma-net.nl (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by mailrelay02.solcon.nl (8.12.11/SQL-8.12.11-5/8.12.11) with ESMTP id j6IDi0dD030373; Mon, 18 Jul 2005 15:44:00 +0200 Original-Received: by server-1.pragma-net.nl (Postfix, from userid 65534) id D1BEC312CB; Mon, 18 Jul 2005 15:00:47 +0200 (CEST) Original-Received: from [10.100.1.52] (unknown [10.100.1.52]) by server-1.pragma-net.nl (Postfix) with ESMTP id 786391838E; Mon, 18 Jul 2005 13:00:46 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en Original-To: Mojca Miklavec , mailing list for ConTeXt users In-Reply-To: <6faad9f0050718051840eba60b@mail.gmail.com> X-Virus-Scanned: ClamAV 0.86.1/982/Sun Jul 17 14:45:12 2005 on mailrelay02 X-Virus-Status: Clean X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 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-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on smtp.ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:21449 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:21449 Mojca Miklavec wrote: >Paul Tremblay wrote: > > >>What is the best way to number lines of poetry? >> >>1 This is the first line >> This is the second line >> ... >> >>5 this is the fifth >> ... >> >>10 this is the tenth. >> >> > >This is a solution, written in plain TeX. I hope it is commented well >enough so that you can change it if necessary. You have to surrond the >code with \start...\stop..., but I hope you can do it, otherwise ask >again on the list. > >You can change the current line number any time by simply typing >\lineno=999. You probably have to set \lineno to 0 every time you >start typesetting a poem and restore \everypar={} after you are done >with the current poem (in the definition of \startnumberedpoem ... >\stopnumberedpoem of course, not manually). > >The code attaches some stuff before every paragraph and there's a >macro that checks if the current paragraph number is divisible by >five. It is a macro with square complexity, so if you want to typeset >Iliad or Odyssey :), please let me know so that I'll change it to be >more efficient :) > >The code has a small drawback: you have to write \\ for blank lines. >After I wrote the maco I noticed some comments about redefining the >\par command in Appendix D of the TeXBOOK, typesetting verbatim. If I >manage to fix that too, I'll post it here. > >%%%%%%%%%%%%%%%%%% > >% new counter for counting lines >% it is set to 0 at the beginning, >% but you can redefine it any time by saying \lineno=7 or similar >\newcount\lineno >% if 0, nothing happens, if 1, no line number will be printed >% and the line number won't advance for one >\newcount\isemptyline > > >% templineno = lineno + 5 >% do { >% templineno = templineno - 5 >% } while (templineno > 5); >% >% if (templineno == 0) { >% print lineno >% } > >% only prints \the\lineno if it is divisible by 5 >\def\printonlyfives{% > % define a new counter 'templineno' > \newcount\templineno > % set the temporary counter to the line counter > \templineno=\lineno > % subtract 5 from the temporary counter as long as the counter is positive > \advance\templineno by5 > \loop\advance\templineno by-5\ifnum\templineno>5\repeat > % if the line number is divisible by 5, the temporary counter is 0 > % and the line number will be printed out > \ifnum\templineno=0{\the\lineno}\fi} > >% add this before every paragraph: >% - if this is not an empty line >% - add one to the line number >% - print the line number (if divisible by five) >% - hfill (for right alignment) >\everypar={\ifnum\isemptyline=0 \advance\lineno by1 \printonlyfives\fi\hfill} > >% (if '\\' is already defined for something else, >% you can use some other command name here) >% this will switch off line numbering, make a new line >% and switch line numbering on again >\def\\{\isemptyline=1\crlf\isemptyline=0} > >\obeylines >\dorecurse{30}{the text goes here\par} > > \setuplinenumbering [start=2, step=2, distance=-1em] \startlinenumbering \startlines \fakewords{5}{8} \fakewords{5}{8} \fakewords{5}{8} \fakewords{5}{8} \fakewords{5}{8} \fakewords{5}{8} \fakewords{5}{8} \fakewords{5}{8} \stoplines \stoplinenumbering \setupparagraphnumbering[state=start,distance=-1em] \fakewords{5}{8} \par \fakewords{5}{8} \par \fakewords{5}{8} \par \fakewords{5}{8} \par \fakewords{5}{8} \par \fakewords{5}{8} \par \fakewords{5}{8} \par \fakewords{5}{8} \par -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------