I'm trying to make multi-language index. I use xelatex
and xindy
. In my document there are polish, lithuanian and russian terms. The problem is with russian ones. I found some alike solutions on how to mix latin and cyrillic terms in index but all they are not completely correct and not fully suit me:
solution 1: no lettergroups for latin based words.
solution 2: command require "lang/russian/utf8.xdy"
causes letter-groups redefinitions and throws warnings ("Ђ" now maps to letter group "Рђ"
and so on) and results wrong sorting (e.g. latin 'A' goes to cyrillic 'A' group. That's why "apple" appears after "notepad"). Same problem here.
solution 3: this solution uses russian language as main which is not what I want. The cyrillic words must appears after the latin ones.
solution 4: the same problem as above.
The closest solution is:
\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{polish}
\setotherlanguage{russian}
\setmainfont{Linux Libertine O}
\usepackage[xindy]{imakeidx}
\makeindex [program=texindy, options = -C utf8 -M mystyle2.xdy -L polish]
\usepackage{filecontents}
\begin{filecontents*}{mystyle2.xdy}
(require "makeindex.xdy")
(require "lang/polish/utf8.xdy")
(require "lang/lithuanian/utf8.xdy")
(define-letter-groups
("Č" "Š" "Ū" "Ž" ;lithuanian specific letter groups
"А" "Б" "В" "Г" "Д" "Е" "Ё" "Ж" "З" "И" "Й" "К" "Л" "М" "Н" "О" "П" "Р" "С" "Т" "У" "Ф" "Х" "Ц" "Ч" "Ш" "Щ" "Ъ" "Ы" "Ь" "Э" "Ю" "Я" ;russian specific letter groups
)
)
(markup-letter-group
:open-head "~n~n \textbf {\Large "
:close-head "}~n \nopagebreak"
:capitalize)
\end{filecontents*}
\begin{document}
section{First}
%polish
\index{Ap} \index{Lipa} \index{Łaj} \index{Nos} \index{Sima} \index{Siesławin} \index{Skodlarski} \index{Salut} \index{Well} \index{Święto} \index{Żuk}
%lithuanian
\index{Ąsotis} \index{Liepa} \index{Šimkus} \index{Žas}
%russian
\index{Арбуз} \index{Волос} \index{Дерево} \index{Жиденький} \index{Пуля} \index{Пуп}
\printindex
\end{document}
But here are certain failings too. Some words are assigned to wrong groups: "Salut" is in correct "S" group, but "Sima" and "Siesławin" somehow goes to russian "Ш" and "Skodlarski" goes to russian "Ю". Also in a such solution there is no handling of lower cases (not critical because I use index only for surnames but may matter in most general case).