From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/76433 Path: news.gmane.org!not-for-mail From: Alan Bowen Newsgroups: gmane.comp.tex.context Subject: Re: indexing puzzle Date: Sat, 26 May 2012 08:41:29 -0400 Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1338419286==" X-Trace: dough.gmane.org 1338036100 5465 80.91.229.3 (26 May 2012 12:41:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 26 May 2012 12:41:40 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat May 26 14:41:39 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 1SYGJN-0000PT-Nd for gctc-ntg-context-518@m.gmane.org; Sat, 26 May 2012 14:41:37 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id B6434101E2; Sat, 26 May 2012 14:41:36 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id IyY9fv6ANDgh; Sat, 26 May 2012 14:41:34 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 7CC9E101DF; Sat, 26 May 2012 14:41:34 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 9395C101DF for ; Sat, 26 May 2012 14:41:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Pm9TsciQJ5Vq for ; Sat, 26 May 2012 14:41:31 +0200 (CEST) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by balder.ntg.nl (Postfix) with ESMTP id E91E8101DD for ; Sat, 26 May 2012 14:41:31 +0200 (CEST) Original-Received: from mail-qc0-f169.google.com (mail-qc0-f169.google.com [209.85.216.169]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id q4QCfUs7031252 for ; Sat, 26 May 2012 14:41:30 +0200 Original-Received: by qcsd16 with SMTP id d16so1259112qcs.14 for ; Sat, 26 May 2012 05:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=rmW3jd0ibYI2DPMwqXRLy35mQnzohbqcDVgD7ZuA1+I=; b=Ih1OQ3VH4kjmaMetxpnYdUkNSBcobSewOD6y+QfOWcnJteFm5smd1QkvFYFdoOxUqz A8aQGQoLWpbLrQ19zQ39beLBLIS9vYrnjoV9Iz/0W06gXeoTE1m2yaf95FDcWX+9YZCR aboFO6iOnk6UWj7AoM4+jpFKWN63KwNlvrVDvrDf7I2651H+1KhRQPgHunPgwnfk4Q1s bRmg/rrkKzsQOiN1wA502S+Mw8gQs+cj0TdhHLUGHmvK4/GTgtSix11EAvlfYE5eOry4 a4aNNSYByn3WedOd1qc3u/Ha15UjLZA9DUktxeVcjKzS6fz2YnxfduEJlWLqxqacnN2H 2sgw== Original-Received: by 10.229.105.145 with SMTP id t17mr627491qco.123.1338036089445; Sat, 26 May 2012 05:41:29 -0700 (PDT) Original-Received: by 10.229.14.70 with HTTP; Sat, 26 May 2012 05:41:29 -0700 (PDT) In-Reply-To: X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=209.85.216.169; 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: 0QHeAFuRk - 3785a34210af - 20120526 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.13 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:76433 Archived-At: --===============1338419286== Content-Type: multipart/alternative; boundary=002354333c4ecedd3004c0efcd31 --002354333c4ecedd3004c0efcd31 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Michael=97 Thank you so much for your very helpful response. 1. \unskip works well. 2. What I currently have is admittedly an ad hoc system for encoding my indices. As you note, the system works for page numbers > 99 where line numbers < 99. When line numbers > 99, I adapt the sort key differently: thus, for Cleomedes, *Cael*. I have [CleomCael105001] for 1.5.1. This works (in MKII) but only because the number of entries is very small. 3. I like your MKII solution=97it is much more general, works well on what = I have, and is certainly less taxing to encode. Many thanks! The book that I trying to index right now is the last of my MKII projects. So I am also interested in, and very grateful, for your MKIV solution. All best, Alan On Thu, May 24, 2012 at 5:14 PM, Rogers, Michael K wrote= : > 1. For \ab you might want > \def\ab{\unskip} > since the space is not the same as the width of a digit. > > 2. Does your solution work with line numbers greater than 99? I tried > to implement your idea and I got the order 25.7, 25.117, 25.37. Probably > more than 99 lines never occurs on a page, so it's a non-issue. But Home= r, > for instance, is often referred to by Book.Line, and the lines go past 10= 0. > Again, perhaps a non-issue for you. > > 3. My own attempts: At first I though what a nice opportunity for me > to learn a little more Lua, which it was. After, I read you wanted a MKI= I > solution. Well, I'm embarrassed at how long I took to do the MKII, but I= 'm > not good at controlling expansion. Anyway, it automatically generates so= rt > keys for the pages by converting digits to letters and padding with initi= al > a's, so that each page or line number is a fixed length (4 in this case, = up > to 10000 pages/lines). For instance, > 123.4--56 is mapped to abcdaaaeaafg > MKII does not seem to sort digit-based keys reliably; MKIV does, and you > can just pad out the digits with zeros. The complete sort key that worke= d > was the catenation of the author, text, and locus key, which is similar t= o > what you have. > > MKII: > \defineregister[Passage][Passages] > ... > % interface to register -- \locuskey indirectly returns a key in \nextkey > > \def\MyPassage#1#2#3{\locuskey{#3}\expandoneargafter\doMyPassage{\nextkey= }{#1}{#2}{#3}} > \def\doMyPassage#1#2#3#4{\Passage[#2#3#1]{{#2}+{#3}+{#4}}} > % Def. of \locuskey#1 > % In: #1<-p1[.l2[--l3]] Out: key stored in \nextkey > ... (see attached file, if interested) > > MKIV: > % interface to register -- expansion in MKIV must be different, because > a direct approach works: > \def\MyPassage#1#2#3{\Passage[#1#2\locuskey{#3}]{#1+#2+#3}} > % Def. of \locuskey > \startluacode > userdata =3D userdata or { } > function userdata.locuskey(x) > context(string.gsub(x,"(%d+)",function (s) return > string.format("%04d",tonumber(s)) end)) > end > \stopluacode > \def\locuskey#1{\ctxlua{userdata.locuskey("#1")}} > > The Mark IV/Luatex one was much nicer, less frustrating to figure out. > > > On May 24, 2012, at 7:06 AM, Alan Bowen wrote: > > For anyone interested in producing classical indices locorum, I have > devised a way that seems to work, although it is not that elegant. > > The first step is to modify the sort keys by counting the number of > digits in the page number: > thus, > [AuthorText01] for pages 1=969, > [AuthorText02] for pages 10=9699, and so on > > The next is to insert the command =93 \ab=94 (note the space) when the l= ine > number is a single digit: > thus > 391. \ab{}2 but 391.12 in the entry specification {Author+Text+page.line} > > For \ab, I have: > > \newdimen\digitwidth > \setbox0=3D\hbox{\tfx\char32} > \digitwidth=3D\wd0 > > \def\ab{\tfx\kern-\digitwidth} > > The hitch here is that the font size is not context dependent. > > Alan > > On Tue, May 22, 2012 at 6:39 PM, Alan Bowen wrote= : > > I have been trying to index the passages cited in a book and would be > grateful for some tactical advice. > > There are several works by a single author, and it is customary to cite > each text by page and line number, as in 1253.12 (page 1253, line12), for > example. > > I have a sort key for each work. But now I need a way to get the entry > > 1253.7 (page 1253, line 7) before the entry > 1253.12 (page 1253, line 12). > > \[Passage[AuthorText]{Author+Text+1253.07}1253.7 or > \[Passage[AuthorText]{Author+Text+1253.07}1253. 7 > would work, but it is really better to have the index entry as =931253.7= =94 > rather than as =931253.07=94 or =931253. 7=94 > > I have experimented with different sort keys=97e.g., AuthorText125307=97= and > can generate an index with the 1235.7 and so on in the proper place and > form, say, before 1253.12. > > But then the problem is that I also get entire sequences of entries out > of order (485.19, 485.21 before 477.31, and so on). Very puzzling. > (Restoring the sort key AuthorText removes the latter problems but then > leaves 1253.7 in the wrong place.) > > If anyone has experience with this or just some ideas for a solution, > their suggestions will be most welcome. > > I am using the MKII in the latest ConTeXt standalone. > > Alan > > > > ------------------------------ > > This e-mail message (including any attachments) is for the sole use of > the intended recipient(s) and may contain confidential and privileged > information. If the reader of this message is not the intended > recipient, you are hereby notified that any dissemination, distribution > or copying of this message (including any attachments) is strictly > prohibited. > > If you have received this message in error, please contact > the sender by reply e-mail message and destroy all copies of the > original message (including attachments). > > > _________________________________________________________________________= __________ > 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 > > _________________________________________________________________________= __________ > --002354333c4ecedd3004c0efcd31 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Michael=97

Thank you so much for your very helpful response.

1. \unskip works well.=

2.= What I currently have is admittedly an ad hoc system for encoding my indic= es. As you note, the system works for =A0page numbers > 99 where line nu= mbers < 99. When line numbers > 99, I adapt the sort key differently:= thus, for Cleomedes,=A0Cael. I have [CleomCael105001] for 1.5.1. Th= is works (in MKII) but only because the number of entries is very small.

3.= I like your MKII solution=97it is much more general, works well on what I = have, and is certainly less taxing to encode. Many thanks! =A0

Th= e book that I trying to index right now is the last of my MKII projects. So= I am also interested in, and very grateful, for =A0your MKIV solution.

Al= l best, Alan


On Thu, May= 24, 2012 at 5:14 PM, Rogers, Michael K <mroge02@emory.edu> = wrote:
1. For \ab you might want
=A0 =A0 \def\ab{\unskip}
since the space is not the same as the width of a digit.

2. Does your solution work with line numbers greater than 99? =A0I tri= ed to implement your idea and I got the order 25.7, 25.117, 25.37. =A0Proba= bly more than 99 lines never occurs on a page, so it's a non-issue. =A0= But Homer, for instance, is often referred to by Book.Line, and the lines go past 100. =A0Again, perhaps a non-issue = for you.

3. =A0My own attempts: =A0At first I though what a nice opportunity fo= r me to learn a little more Lua, which it was. =A0After, I read you wanted = a MKII solution. =A0Well, I'm embarrassed at how long I took to do the = MKII, but I'm not good at controlling expansion. =A0Anyway, it automatically generates sort keys for the pages by convertin= g digits to letters and padding with initial a's, so that each page or = line number is a fixed length (4 in this case, up to 10000 pages/lines). = =A0For instance,
=A0 =A0 123.4--56 is mapped to =A0abcdaaaeaafg
MKII does not seem to sort digit-based keys reliably; MKIV does, and y= ou can just pad out the digits with zeros. =A0The complete sort key that wo= rked was the catenation of the author, text, and locus key, which is simila= r to what you have.

MKII:
\defineregister[Passage][Passages]=A0
...
% interface to register -- \locuskey indirectly returns a key in \next= key
\def\MyPassage#1#2#3{\locuskey{#3}\expandoneargafter\doMyPassage{\next= key}{#1}{#2}{#3}}
\def\doMyPassage#1#2#3#4{\Passage[#2#3#1]{{#2}+{#3}+{#4}}}
% Def. of \locuskey#1
% =A0 =A0In: #1<-p1[.l2[--l3]] Out: key stored in \nextkey
... (see attached file, if interested)

MKIV:
% interface to register -- expansion in MKIV must be different, becaus= e a direct approach works:
\def\MyPassage#1#2#3{\Passage[#1#2\locuskey{#3}]{#1+#2+#3}}
% Def. of \locuskey
\startluacode
userdata =3D userdata or { }
function userdata.locuskey(x)
=A0 =A0 context(string.gsub(x,"(%d+)",function (s) return st= ring.format("%04d",tonumber(s)) end))
end
\stopluacode
\def\locuskey#1{\ctxlua{userdata.locuskey("#1")}}

The Mark IV/Luatex one was much nicer, less frustrating to figure out.=


On May 24, 2012, at 7:06 AM, Alan Bowen wrote:

For anyone interested in producing classical indi= ces locorum, I have devised a way that seems to work, although it is not th= at elegant.

The first step is to modify the sort keys by counting the number of di= gits in the page number:=A0
thus,
[AuthorText01] for pages 1=969,=A0
[AuthorText02] for pages 10=9699, and so on

The next is to insert the command =93 \ab=94 (note the space) when the= line number is a single digit:=A0
thus=A0
391. \ab{}2 but 391.12 in the entry specification {Author+Text+page.li= ne}

For \ab, I have:

\newdimen\digitwidth
\setbox0=3D\hbox{\tfx\char32}
\digitwidth=3D\wd0

\def\ab{\tfx\kern-\digitwidth}

The hitch here is that the font size is not context dependent.

Alan

On Tue, May 22, 2012 at 6:39 PM, Alan Bowen <bowenalan03@= gmail.com> wrote:
I have been trying to index the passages cited in a book and would be grate= ful for some tactical advice.

There are several works by a single author, and it is customary to cit= e each text by page and line number, as in 1253.12 (page 1253, line12), for= example.

I have a sort key for each work. But now I need a way to get the entry=

1253.7 (page 1253, line 7) before the entry
1253.12 (page 1253, line 12).

\[Passage[AuthorText]{Author+Text+1253.07}1253.7 or
\[Passage[AuthorText]{Author+Text+1253.07}1253. 7=A0
would work, but it is really better to have the index entry as =931253= .7=94 rather than as =931253.07=94 or =931253. 7=94

I have experimented with different sort keys=97e.g., AuthorText125307= =97and can generate an index with the 1235.7 and so on in the proper place = and form, say, before 1253.12.

But then the problem is that I also get entire sequences of entries ou= t of order (485.19, 485.21 before 477.31, and so on). Very puzzling. (Resto= ring the sort key AuthorText removes the latter problems but then leaves 12= 53.7 in the wrong place.)

If anyone has experience with this or just some ideas for a solution, = their suggestions will be most welcome.

I am using the MKII in the latest ConTeXt standalone.

Alan




This e-mail message (including any attachments) is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this message (including any attachments) is strictly
prohibited.

If you have received this message in error, please contact
the sender by reply e-mail message and destroy all copies of the
original message (including attachments).

_______________________________________________________________________= ____________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-context@ntg.nl / <= a href=3D"http://www.ntg.nl/mailman/listinfo/ntg-context" target=3D"_blank"= >http://www.ntg.nl/mailman/listinfo/ntg-context
webpage =A0: http://= www.pragma-ade.nl / http://tex.aanhet.net
archive =A0: http://foundry.supelec.fr/projects/contextrev/
wiki =A0 =A0 : http:= //contextgarden.net
___________________________________________________________________________= ________

--002354333c4ecedd3004c0efcd31-- --===============1338419286== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============1338419286==--