From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/21448 Path: news.gmane.org!not-for-mail From: Mojca Miklavec Newsgroups: gmane.comp.tex.context Subject: Re: how to number poetry? Date: Mon, 18 Jul 2005 14:18:20 +0200 Message-ID: <6faad9f0050718051840eba60b@mail.gmail.com> References: <20050713205905.GA23919@localhost.localdomain> Reply-To: Mojca Miklavec , mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1121689124 14394 80.91.229.2 (18 Jul 2005 12:18:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 18 Jul 2005 12:18:44 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Mon Jul 18 14:18:42 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 1DuUZt-000280-Qz for gctc-ntg-context-518@m.gmane.org; Mon, 18 Jul 2005 14:18:33 +0200 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 40294127B3; Mon, 18 Jul 2005 14:18:31 +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 00721-07; Mon, 18 Jul 2005 14:18:25 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id D5BFF12798; Mon, 18 Jul 2005 14:18:24 +0200 (CEST) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 6179212798 for ; Mon, 18 Jul 2005 14:18:23 +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 07000-05 for ; Mon, 18 Jul 2005 14:18:22 +0200 (CEST) Original-Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.201]) by ronja.ntg.nl (Postfix) with ESMTP id 1124B12797 for ; Mon, 18 Jul 2005 14:18:21 +0200 (CEST) Original-Received: by nproxy.gmail.com with SMTP id x4so256926nfb for ; Mon, 18 Jul 2005 05:18:20 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ErxEzutwHTC6OY5UhlKIjIvLz4PncAWH4bm6uVFO3hRudwaxjwxkYiAcuGlZ26rbqKSE8dIU8EKxYVfKEo9mpGyA2aIJU3r/qVpaqCL8m8tyYRcGf32ToAVEGz9+Ha4864ACxGXIQWGSP8l3TINM1A4wWCLhBnQxqbLayeV1vy8= Original-Received: by 10.48.3.11 with SMTP id 11mr180549nfc; Mon, 18 Jul 2005 05:18:20 -0700 (PDT) Original-Received: by 10.48.247.2 with HTTP; Mon, 18 Jul 2005 05:18:20 -0700 (PDT) Original-To: mailing list for ConTeXt users In-Reply-To: <20050713205905.GA23919@localhost.localdomain> Content-Disposition: inline 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:21448 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:21448 Paul Tremblay wrote: > What is the best way to number lines of poetry? >=20 > 1 This is the first line > This is the second line > ... >=20 > 5 this is the fifth > ... >=20 > 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=3D999. You probably have to set \lineno to 0 every time you start typesetting a poem and restore \everypar=3D{} 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=3D7 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 =3D lineno + 5 % do { % templineno =3D templineno - 5 % } while (templineno > 5); % % if (templineno =3D=3D 0) { % print lineno % } % only prints \the\lineno if it is divisible by 5 \def\printonlyfives{% =09% define a new counter 'templineno' =09\newcount\templineno =09% set the temporary counter to the line counter =09\templineno=3D\lineno =09% subtract 5 from the temporary counter as long as the counter is positi= ve =09\advance\templineno by5 =09\loop\advance\templineno by-5\ifnum\templineno>5\repeat =09% if the line number is divisible by 5, the temporary counter is 0 =09% and the line number will be printed out =09\ifnum\templineno=3D0{\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=3D{\ifnum\isemptyline=3D0 \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=3D1\crlf\isemptyline=3D0} \obeylines \dorecurse{30}{the text goes here\par} %%%%%%%%%%%%%%%%%% Mojca