[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature request: multilevel indexing for TeX
From: |
Gavin Smith |
Subject: |
Re: Feature request: multilevel indexing for TeX |
Date: |
Thu, 28 Feb 2019 20:15:25 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, Feb 28, 2019 at 04:50:38AM -0700, address@hidden wrote:
> > I remember there were problems with the positioning of @sortas: I'd like
> > to see if they could be fixed.
>
> Can you elaborate?
@cindex aaa @sortas{bbb}
didn't work completely properly as it output the index entry as "bbb ",
with a trailing space. I've tried to fix it in commit 0539d4e
> > > Could we do \tertiary also? Or is that asking too much?
> >
> > I don't see why not, it would just require more sorting logic in
> > texindex.
>
> Excellent. If you can give me a clear spec on the input and output
> to texindex I can dive into it. (When you have one, of cousre.)
> I'm pretty sure I still have committer rights to the project.
There are some questions we need to resolve:
* What happens if there is an index entry with no secondary term and an
identical index entry with a secondary term, e.g.
@cindex foo
@cindex foo @sub bar
I think that both should be kept. When I tested it with C texindex, one
of them was lost in the output.
* Do we keep @defop, and the other commands in texinfo.tex currently using
\dosubind, as creating single-level index entries? I assume yes, even
if it was different before: no-one to my knowledge ever complained that
the behaviour changed, and it is more stable to keep things as they are,
even if in the past they were possibly different. I suspect not many
are using these commands anyway.
* Sorting: The index auxiliary file format, with \entry, only supports a
single index sort key. If that is kept, what happens when index entries
with the same primary text do not form a contiguous block within the
sorted index, e.g.
@cindex foo @sub bar @sortas{A}
@cindex pppppppppppp @sortas{B}
@cindex foo @sub baz @sortas{C}
Should the entries for "foo" appear before or after those
for "pppppppppppp" in the sorted index?
Perhaps sort keys could be generated for primary, secondary and
tertiary entry text separately, and simply concatenated to produce the
sort key. @sortas would be local to each "segment", and if there was no
@sortas command, the sort key for that segment would be generated in the
usual way.
But simple concatenation wouldn't work: consider
@cindex aa @sub a -- key is aaa
@cindex aa @sub z -- key is aaz
@cindex aah -- key is aah
then the "aa" entries are split in two by the "aah" entry.
Maybe a special marker character could be output that texindex treats
specially: e.g. the above would be output as
\entry{aa^_a}{1}{aa}{a}
\entry{aa^_z}{3}{aa}{z}
\entry{aah}{5}{aah}
where ^_ is a 0x1F byte.
Using a space instead may even suffice:
\entry{aa a}{1}{aa}{a}
\entry{aa z}{3}{aa}{z}
\entry{aah}{5}{aah}
* If somebody uses contradictory sort keys for the primary text: this
doesn't make sense, and unpredictable results are acceptable: e.g.
@cindex foo @sortas{aaa} @sub one
@cindex foo @sortas{zzz} @sub two
Here the "foo" entries could be sorted as "aaa" or "zzz" and it wouldn't
matter much which.
* We cannot actually use @sub because this clashes with the subscript
command. Using @tab or @indent instead may be a possibility.