4

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

enter image description here

(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:

enter image description here

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\ "
headings_flag 1
heading_prefix "\\nopagebreak\n\\tikz\\node at (0pt,0pt) [draw=none,fill=ocre!50,line width=1pt,inner sep=5pt]{\\parbox{\\linewidth-2\\fboxsep-2\\fboxrule-2pt}{\\centering\\large\\sffamily\\bfseries\\textcolor{white}{" heading_suffix "}}};\\vspace*{0.2cm}\\nopagebreak\n"

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{notepad}
\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 – percusse Nov 28 '16 at 21:17
  • 1
    The main problem is that MakeIndex only sorts the Latin alphabet. You should consider Xindy. – egreg Nov 28 '16 at 21:25
  • @egreg I tried. You can see my tryings in my question. Well, I will remove MakeIndex from this question – Lust_For_Love Nov 28 '16 at 21:26
  • @eqreq Well, now the question is how to fix wrong sorting by xindy and how to style it. – Lust_For_Love Nov 28 '16 at 23:18
  • try xindy -M texindy -L russian -C utf8 filename.idx – michal.h21 Nov 29 '16 at 10:24
5

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.

enter image description here

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[breaklinks,pdftex,hyperindex,unicode]{hyperref} 

\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}{ "
        :close-head "}}};\vspace*{0.2cm}\nopagebreak"
    :capitalize)
\end{filecontents*}

\begin{document}

\chapter{Первая}

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

\printindex

\end{document}

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.