I see a question here which has the exact same problem that I am facing, but for a different language. Unfortunately it is closed because of lack of clarity and a reproducible MWE. This is an attempt to reformulate that question by minimizing the unnecessary details.
Assume that in a script X, the correct sequence of letters is {a,c,b,ab}. Notice that ab is supposed to be considered as a letter itself (I know this doesn't make any sense in English, but just assume it for some time).
Now consider the following example:
\documentclass{article}
\usepackage{imakeidx}
\makeindex[title={Index},name={foo}]
\begin{document}
abcd\index[foo]{abcd}.
acbd\index[foo]{acbd}.
bcad\index[foo]{bcad}.
bbcd\index[foo]{bbcd}.
\printindex[foo]
\end{document}
My terms are (obviously) sorted in the following order:
- abcd
- acbd
- bbcd
- bcad
but given the natural order of my script, the sorting I want is:
- acbd
- bcad
- bbcd
- abcd
Is there any way to write custom rules for getting something like this? Note that writing rules is going to be important, because it's not a finite list or a handful words on which I am working. I need to automate it with rules for a significantly long list of words.
PS: Sticking to imakeidx is not a necessity. I am open to other packages. The script I am working on anyways needs xe/lualatex, so since lualatex is required lua solutions are also welcome. Basically any approach that works for this is acceptable.
abas a single character. – Niranjan Jan 20 '23 at 09:37o\"(also a single letter)? – John Kormylo Jan 20 '23 at 17:48\_compoundcharsmacro). – wipet Jan 22 '23 at 17:36