So I am trying the change the way xindy is sorting umlauts in an index file by prescribing custom sort-rules.
This is the myfile.xdy that I use:
(require "lang/german/duden-utf8-lang.xdy")
(sort-rule "Ä" "Ae")
(sort-rule "Ö" "Oe")
(sort-rule "Ü" "Ue")
(sort-rule "ä" "ae")
(sort-rule "ö" "oe")
(sort-rule "ü" "ue")
And here is a minimal example for a document:
\documentclass[]{article}
\usepackage{fontspec}
\usepackage[ngerman]{babel}
\usepackage[xindy, splitindex]{imakeidx}
\def\xindylangopt{-M lang/german/myfile}
\makeindex[name=test, options=\xindylangopt]
\begin{document}
foo \index[test]{Aal} \index[test]{Aeal} \index[test]{Äal} \index[test]{Abal} \index[test]{Afal}
\index[test]{Ual} \index[test]{Ueal} \index[test]{Üal} \index[test]{Ubal} \index[test]{Ufal}
\index[test]{Oal} \index[test]{Oeal} \index[test]{Öal} \index[test]{Obal} \index[test]{Ofal}
\printindex[test]
\end{document}
This is what the output looks like:
But this is still the original sorting where the umlauts are treated as if they were their respective vocal, i.e. 'Ä' is treated as 'A' and so on. What I would like is that they are treated as their respective vocal followed by the letter 'e', i.e. 'Äal' would be placed between 'Aeal' and 'Afal' in this example. What am I doing wrong? Can the sorting rules not be overwriten like that? Do I even need a custom file for this or are there already native modules that do this kind of sorting?
(require "lang/german/din5007-utf8-lang.xdy")
should be sufficient. Unfortunately,xindy
replaces readable letters by some opaque bytes for sorting (you can see it in anylang/german/*-utf8.xdy
), so altering sorting rules by a user becomes complicated.