3

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}

bad index

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).

0

I did it in this way (slightly modified code taken from Sergey Golovan book):

(define-letter-groups ("A" "Ą" "B" "C" "Ć" "Č" "D" "E" "Ę" "F" "G" "H" "I" "J" "K"
"L" "Ł" "M" "N" "O" "Ó" "P" "Q" "R" "S" "Ś" "Š" "T" "U" "V" "W" "X" "Y" "Z" "Ź" "Ż" "Ž"
"А" "Б" "В" "Г" "Д" "Е" "Ж" "З" "И" "Й" "К"
"Л" "М" "Н" "О" "П" "Р" "С" "Т" "У" "Ф" "Х" "Ц" "Ч" "Ш" "Щ" "Ъ"
"Ы" "Ь" "Э" "Ю" "Я" 
))
(define-rule-set "alphabetize"
:rules (
("a" "A") ("b" "B")
("c" "C") ("d" "D") ("e" "E") ("f" "F") ("g" "G") ("h" "H")
("i" "I") ("j" "J") ("k" "K") ("l" "L") ("m" "M") ("n" "N")
("o" "O") ("p" "P") ("q" "Q") ("r" "R") ("s" "S") ("t" "T")
("u" "U") ("v" "V") ("w" "W") ("x" "X") ("y" "Y") ("z" "Z")
("а" "А") ("б" "Б") ("в" "В") ("г" "Г") ("д" "Д") ("е" "Е")
("Ё" "Е") ("ё" "Е") ("ж" "Ж") ("з" "З") ("и" "И") ("й" "Й")
("к" "К") ("л" "Л") ("м" "М") ("н" "Н") ("о" "О") ("п" "П")
("р" "Р") ("с" "С") ("т" "Т") ("у" "У") ("ф" "Ф") ("х" "Х")
("ц" "Ц") ("ч" "Ч") ("ш" "Ш") ("щ" "Щ") ("ъ" "Ъ") ("ы" "Ы")
("ь" "Ь") ("э" "Э") ("ю" "Ю") ("я" "Я") 
))

(define-rule-set "ignore-special"
:rules (("?" "") ("." "") ("-" "") ("'" "") ("!" "")))

(define-sort-rule-orientations (forward forward))
(use-rule-set :run 0
:rule-set ("alphabetize" "ignore-special"))


(markup-letter-group
  :open-head "~n~n  \textbf {\Large "
  :close-head "}~n  \nopagebreak"
  :capitalize)

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.