On Sun, Oct 11, 2026 at 07:02:18PM +0000, Werner LEMBERG wrote:
> > Here there are not only two @sortas, but also nested @sortas, the
> > expanded Texinfo code (expanded by texi2any) is like:
> >
> > @findex @sortas{@sortas{bbb}ddd X}@sortas{bbb}ddd
> >
> > texi2any warns about this, rightly in my opinion:
> >
> > sortas_sortas.texi:13: warning:
> > @sortas should not appear in @sortas (possibly involving @funindex)
> > sortas_sortas.texi:13: warning:
> > @sortas should only appear in an index entry (possibly involving
> > @funindex)
> >
> > My feeling is that if Texinfo TeX is broken by this input it is not
> > really a problem.
>
> I'm not convinced. The argument to `@sortas` is for the index
> generator; I would expect that the argument of `@sortas` gets handled
> in verbatim mode, i.e., it gets completely ignored by TeX except while
> writing the unsorted index file.
This is not how it is done in texi2any. What is inside a @sortas is
considered to be Texinfo code. However, @sortas should only contain
'plain text', which means only @-commands like @@, @{, @comma{}, @'e,
@AA{}, @equiv{} and similar, anything else gets a warning.
> > texi2any does not warn and use the second to sort, as you said. I
> > have no problem with not warning, however, what is used for sorting
> > should be considered to be undefined, could be the first @sortas,
> > the second one, both together, none at all.
>
> Why undefined? I suggest that the last entry always wins.
I do not think that we should consider this behaviour as expected. Two
@sortas in the same entry is not a normal construct, it is ok not to
consider it as a syntax error, but I do not think that we should commit
yet to any expectation about the result.
--
Pat