I am preparing an index with entries that use the International Phonetic Alphabet (which largely consists of lowercase Latin letters, but with additions. I have specified my desired sort order in an .xdy
file. When xindy prepares the index, the groupings appear in my specified order. For instance, the 'ʌ' entries appear before the 'a' entries. But when sorting keys, the default sorting order occurs: aʌ appears after aa instead of before. (I've duplicated the sort order that appears in the code below.) Do I need to specify some further sorting rule?
xelatex
xindy -I latex -o xindy-ipa-sorting.ind -M ipa-alphabet xindy-ipa-sorting.idx
xelatex
xindy-ipa-sorting.tex:
\documentclass{book}
\usepackage{polyglossia}
\setmainfont{Times New Roman}
\usepackage{makeidx,lipsum}
\makeindex
\begin{document}
\lipsum[1]
\index{ʌa}
\index{ʌʌ}
\index{aa}
\index{aʌ}
\printindex
\end{document}
ipa.xdy (base on this answer):
;; xindy style file for an index with extended alphabet
(define-attributes (("default" "textbf" "textit" "hyperpage")))
;; "see" and "see also"
(define-crossref-class "see")
(markup-crossref-list :class "see" :open "\see{" :sep "; " :close "}{}")
(define-crossref-class "seealso")
(markup-crossref-list :class "seealso" :open "\seealso{" :sep "; " :close "}{}")
(markup-crossref-layer-list :sep ", ")
(require "base/numeric-sort.xdy")
(define-location-class "arabic-page-numbers" ("arabic-numbers"))
(define-location-class "roman-page-numbers" ("roman-numbers-lowercase"))
(define-location-class "Roman-page-numbers" ("roman-numbers-uppercase"))
(define-location-class "alpha-page-numbers" ("alpha"))
(define-location-class "Alpha-page-numbers" ("ALPHA"))
(define-location-class-order ("roman-page-numbers"
"Roman-page-numbers"
"arabic-page-numbers"
"alpha-page-numbers"
"Alpha-page-numbers"
"see"
"seealso"))
(require "lang/english/utf8.xdy")
(define-alphabet "latin-ipa"
("ʌ" "a" "b" "d" "dʒ" "e" "ɛ" "f" "ɡ" "ɣ" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "ʃ" "t" "tʃ" "u" "ʊ" "w" "x" "z" "ʒ" "ʔ"))
(define-letter-groups
("ʌ" "a" "b" "d" "dʒ" "e" "ɛ" "f" "ɡ" "ɣ" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "ʃ" "t" "tʃ" "u" "ʊ" "w" "x" "z" "ʒ" "ʔ"))
(define-letter-group "ʌ" :before "a")
(define-letter-group "dʒ" :after "d" :before "e")
(define-letter-group "ɛ" :after "e" :before "f")
(define-letter-group "ɣ" :after "ɡ" :before "h")
(define-letter-group "ʃ" :after "s" :before "t")
(define-letter-group "tʃ" :after "t" :before "u")
(define-letter-group "ʊ" :after "u" :before "w")
(define-letter-group "ʒ" :after "z" :before "ʔ")
(define-letter-group "ʔ" :after "ʒ" )
;; =======================
;; merge rules
;; =======================
;; LaTeX and TeX conventions
(merge-rule "\\LaTeXe *" "LaTeX2e" :eregexp :again)
(merge-rule "\\BibTeX *" "BibTeX" :eregexp :again)
(merge-rule "\\AmSTeX *" "AmSTeX" :eregexp :again)
(merge-rule "\\AmSLaTeX *" "AmSLaTeX" :eregexp :again)
(merge-rule "\\XeT *" "XeT" :eregexp :again)
(require "base/tex.xdy")
(markup-locref :open "\textbf{" :close "}" :attr "textbf")
(markup-locref :open "\textit{" :close "}" :attr "textit")
(markup-locref :open "\hyperpage{" :close "}" :attr "hyperpage")
;; =======================
;; sort rules
;; =======================
;; list pali capitals under pali lowercase
(sort-rule "g" "ɡ")
;;(sort-rule "Ā" "ā")
;;(sort-rule "Ṃ" "ṃ")
;;(sort-rule "Ī" "ī")
;;(sort-rule "Ñ" "ñ")
;; list latin capitals under latin lowercase
;;(sort-rule "A" "a")
;;(sort-rule "B" "b")
;;(sort-rule "C" "c")
;;(sort-rule "D" "d")
;;(sort-rule "E" "e")
;;(sort-rule "F" "f")
;;(sort-rule "G" "g")
;;(sort-rule "H" "h")
;;(sort-rule "I" "i")
;;(sort-rule "J" "j")
;;(sort-rule "K" "k")
;;(sort-rule "L" "l")
;;(sort-rule "M" "m")
;;(sort-rule "N" "n")
;;(sort-rule "O" "o")
;;(sort-rule "P" "p")
;;(sort-rule "Q" "q")
;;(sort-rule "R" "r")
;;(sort-rule "S" "s")
;;(sort-rule "T" "t")
;;(sort-rule "U" "u")
;;(sort-rule "V" "v")
;;(sort-rule "W" "w")
;;(sort-rule "X" "x")
;;(sort-rule "Y" "y")
;;(sort-rule "Z" "z")
;; ======================
;; markup rules
;; ======================
(require "base/page-ranges.xdy")
(markup-index :open
"\begin{theindex}
\providecommand*\lettergroupDefault[1]{}
\providecommand*\lettergroup[1]{%
\par\textbf{#1}\par
\nopagebreak
}
"
:close "~n~n\end{theindex}~n"
:tree)
(markup-indexentry :open "~n \item " :depth 0)
(markup-indexentry :open "~n \subitem " :depth 1)
(markup-indexentry :open "~n \subsubitem " :depth 2)
(markup-locclass-list :open ", " :sep ", ")
(markup-locref-list :sep ", ")
;; letter group markup
(markup-letter-group-list :sep "~n~n \indexspace~n")
(markup-letter-group :open-head "~n \lettergroupDefault{" :close-head "}" :group "default")
(markup-letter-group :open-head "~n \lettergroup{" :close-head "}")