From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/76438 Path: news.gmane.org!not-for-mail From: Alan Bowen Newsgroups: gmane.comp.tex.context Subject: Re: indexing puzzle Date: Sat, 26 May 2012 10:12:32 -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="===============1359615722==" X-Trace: dough.gmane.org 1338041564 10255 80.91.229.3 (26 May 2012 14:12:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 26 May 2012 14:12:44 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat May 26 16:12:42 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 1SYHjV-0002I4-AH for gctc-ntg-context-518@m.gmane.org; Sat, 26 May 2012 16:12:41 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 6A911101DD; Sat, 26 May 2012 16:12:40 +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 l2KrO51tZoRH; Sat, 26 May 2012 16:12:40 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id CA5E9101DF; Sat, 26 May 2012 16:12:37 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id B6C07101DF for ; Sat, 26 May 2012 16:12: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 9bYDG9eUX-eR for ; Sat, 26 May 2012 16:12:34 +0200 (CEST) Original-Received: from filter1-til.mf.surf.net (filter1-til.mf.surf.net [194.171.167.217]) by balder.ntg.nl (Postfix) with ESMTP id E7604101DD for ; Sat, 26 May 2012 16:12:34 +0200 (CEST) Original-Received: from mail-qc0-f169.google.com (mail-qc0-f169.google.com [209.85.216.169]) by filter1-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id q4QECW6b010659 for ; Sat, 26 May 2012 16:12:33 +0200 Original-Received: by qcsd16 with SMTP id d16so1284793qcs.14 for ; Sat, 26 May 2012 07:12:32 -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=Y6BNgLWaLLlkxcFHRhFhZSdjty9NTUNAhYOWllav1VQ=; b=zQ1jTvukDDxkLj9w1N0FSVeyW16Bbk18EXAes9yTUIHimL+R60vhh4ZMS/tak9lTp7 lUfHYMBa25KoznJHrbz0ePwbu8RWpJSqht+xJhF2VNfjK0pQuMT9UE+0LnxfjOxdmpUS ivXeEF9ZUzWOrc2zLQ21SqWxHKuN66o6H5N14k3x9ETp3yc7XfamEKV9bsfCLtEboSXc Np6/BMod0kc30Mg/bBsCiOCB0aaHWHm+GtWAuifuzv/fR9nHqcmC1iOdgmcjRZ5IfLEn 14huxa8AARquLVgVJTV2uT9GCnLsSmk80CaI8UTiKrTeq0FOoqKKyJK/nZg05ROYN9lC Oxxw== Original-Received: by 10.224.181.203 with SMTP id bz11mr2617464qab.55.1338041552312; Sat, 26 May 2012 07:12:32 -0700 (PDT) Original-Received: by 10.229.14.70 with HTTP; Sat, 26 May 2012 07:12:32 -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: 0RHeCcxcF - 5ddbdea7abf2 - 20120526 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.217 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:76438 Archived-At: --===============1359615722== Content-Type: multipart/alternative; boundary=20cf303b40556b9b2304c0f1138c --20cf303b40556b9b2304c0f1138c Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable It does indeed! Excellent! A. On Sat, May 26, 2012 at 9:21 AM, Rogers, Michael K wrote= : > Thanks, Alan. Actually, I now think MKIV works without any trickery. I > was perhaps too eager to try a Lua solution. \Passage{Author+Text+Locus} > seems to work fine in the beta today. > > Cheers, Michael > > > > On May 26, 2012, at 8:41 AM, Alan Bowen wrote: > > 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 wh= at > 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 wro= te: > >> 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. Probabl= y >> more than 99 lines never occurs on a page, so it's a non-issue. But Hom= er, >> for instance, is often referred to by Book.Line, and the lines go past 1= 00. >> 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 MK= II >> 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 s= ort >> keys for the pages by converting digits to letters and padding with init= ial >> 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 work= ed >> was the catenation of the author, text, and locus key, which is similar = to >> what you have. >> >> MKII: >> \defineregister[Passage][Passages] >> ... >> % interface to register -- \locuskey indirectly returns a key in \nextke= y >> >> \def\MyPassage#1#2#3{\locuskey{#3}\expandoneargafter\doMyPassage{\nextke= y}{#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 = line >> 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), fo= r >> 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= =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 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 t= o >> 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 >> >> ________________________________________________________________________= ___________ >> > > > _________________________________________________________________________= __________ > 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 > > _________________________________________________________________________= __________ > > > > > _________________________________________________________________________= __________ > 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 > > _________________________________________________________________________= __________ > --20cf303b40556b9b2304c0f1138c Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable It does indeed! Excellent!

A.

On Sat, May 26, 2012 at 9:21 AM, Rogers, Michael K <mroge02@emory.= edu> wrote:
Thanks, Alan. =A0Actually, I now think MKIV works without any trickery. =A0= I was perhaps too eager to try a Lua solution. =A0\Passage{Author+Text+Locu= s} seems to work fine in the beta today.

Cheers, =A0Michael



On May 26, 2012, at 8:41 AM, Alan Bowen wrote:

Michael=97

Thank = you so much for your very helpful response.

1. \un= skip works well.

2. Wha= t I currently have is admittedly an ad hoc system for encoding my indices. = As you note, the system works for =A0page numbers > 99 where line number= s < 99. When line numbers > 99, I adapt the sort key differently: thus, for Cleomedes,=A0Cael. I have [CleomCael1050= 01] for 1.5.1. This works (in MKII) but only because the number of entries = is very small.

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

The bo= ok that I trying to index right now is the last of my MKII projects. So I a= m also interested in, and very grateful, for =A0your MKIV solution.

All be= st, Alan


On Thu, May 24, 2012 at 5:14 PM, Rogers, Michael= K <mroge02@emory.ed= u> 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.co= m> 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-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage =A0: http:/= /www.pragma-ade.nl / http://tex.aanhet.net<= /a>
archive =A0:
http://foundry.supelec.fr/projects/contextrev/
wiki =A0 =A0 : http= ://contextgarden.net
___________________________________________________________________________= ________

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

maillist : ntg-cont= ext@ntg.nl / 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=A0=A0: h= ttp://contextgarden.net
___________________________________________________________________________= ________


_______________________________________________________________________= ____________
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
___________________________________________________________________________= ________

--20cf303b40556b9b2304c0f1138c-- --===============1359615722== 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 ___________________________________________________________________________________ --===============1359615722==--