# Stylish index for cyrillic input with xindy!

I trying to stylish index. I want to implement one cool template in my project and edit it a lot for my pleasure. In order to begin that, I want to implement it without any changes. But in that template makeindex was used. Now I reaslise that it sorts only latin. But I want to sort cyrillic things. So, I consider using xindy programm. I want it to look as following

(But with cyrillic letters)

I can say that I want to play with xindy programms. I want to style it like It can be done using makeindex and special .ist (.mst) files. But my own tryings are all fails. I get the following pretty usual index:

AS you see even FIRST MAIN letters are incorrect, Because there is no N and S in these words.

Here is MWE of main.ist which works with makeindex. But, as I said I can't use makeindex bacause of latin sorting words. So, I want to get this tikz-rectangle-effect repeated in xindy with cyrillic. The questions are

1. How to add this tikz-beaty to a xindy program of making index?

2. How to fix wrong letters N S for such cyrillic input.

MWE _main.ist:

delim_0 "\\dotfill\ "
delim_1 "\\dotfill\ "


And here is MWE:

    \documentclass{book}
\usepackage[T1, T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english, russian]{babel}
\usepackage{tikz}

\usepackage{xcolor}
\definecolor{ocre}{RGB}{150, 120, 182}

\usepackage{calc}
\usepackage[xindy]{imakeidx}
\makeindex

\makeatletter
\newcommand{\rindex}[2][\imki@jobname]{%
\index[#1]{\detokenize{#2}}%
}
\makeatother

\begin{document}

\chapter{Первая}

\rindex{apple}
\rindex{часть}
\rindex{дерево}
\rindex{электрон}

\printindex

\end{document}


I using texindy.exe -L russian -C utf8 %.idx

• I've removed the TikZ tag as it is not related to this as far as I can see Nov 28, 2016 at 21:17
• The main problem is that MakeIndex only sorts the Latin alphabet. You should consider Xindy. Nov 28, 2016 at 21:25
• @egreg I tried. You can see my tryings in my question. Well, I will remove MakeIndex from this question
– user98432
Nov 28, 2016 at 21:26
• @eqreq Well, now the question is how to fix wrong sorting by xindy and how to style it.
– user98432
Nov 28, 2016 at 23:18
• try xindy -M texindy -L russian -C utf8 filename.idx Nov 29, 2016 at 10:24

It is an answer of author of the question -- keep it in mind!

After some work, I found the way, which helps me. I will be grateful if you advice me some cool features or improve my answer.

Well, really cool. Here is MWE:

\documentclass[openany]{book}
\usepackage[T1, T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english, russian]{babel}
\usepackage{tikz}

\usepackage{xcolor}
\definecolor{purpl}{RGB}{150, 120, 182}
\usepackage{calc}

\usepackage[xindy]{imakeidx}
\makeindex[program=texindy, options=-M mystyle.xdy -L russian -C utf8]

\makeatletter
\newcommand{\rindex}[2][\imki@jobname]{%
\index[#1]{\detokenize{#2}}%
}
\makeatother

\usepackage{filecontents}
\begin{filecontents*}{mystyle.xdy}
;;; xindy style file
(markup-locclass-list :open "\dotfill" :sep "")

(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"))

(require
"rules/latin-tolower.xdy")

(use-rule-set
:run 0
:rule-set ("latin-tolower"))

(markup-letter-group
:open-head "\nopagebreak\tikz\node at (0pt,0pt) [draw=none,fill=purpl!50,line width=1pt,inner sep=5pt]{\parbox{\linewidth-2\fboxsep-2\fboxrule-2pt}{\centering\large\sffamily\bfseries\textcolor{white}{ "
:capitalize)
\end{filecontents*}

\begin{document}

\chapter{Первая}

\rindex{часть}
\rindex{дерево}
\rindex{электрон}
\rindex{well}

\printindex

\end{document}

• How to change sorting rules to be "latin first, cyrillic second"?
– andc
Aug 6, 2019 at 5:44