0

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:

enter image description here

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?

  • In your case (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 any lang/german/*-utf8.xdy), so altering sorting rules by a user becomes complicated. – Sergei Golovan Mar 3 at 7:49
  • Amazing, this seems to do the trick! I see, I already looked at some of the standard modules and was very confused by all these weird symbols and prefixes. I wonder why they do it that way. Xindy syntax seems rather outdated. – mapf Mar 3 at 8:46
1

Thanks to @Sergei Golovan, a solution was found. It appears to be sufficient to use the din5007-utf8-lang.xdy-module instead of the duden-utf8-lang.xdy-module as a basis, since the din5007-utf8-lang.xdy-module already sorts the umlauts the way that I was trying to achive. So in case other changes should still be applied to the sorting, the required module needs to be adjusted.

myfile.xdy:

(require "lang/german/din5007-utf8-lang.xdy")

some other custom sort-rules

If no other changes to the sorting need to be applied, it is sufficient to change the xindy language options in the document like so:

\def\xindylangopt{-M lang/german/din5007-utf8-lang}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.