When using the answer I faced the following error message on the 2nd pass (with pdflatex
):
Undefined control sequence. \item \T
It originates from the entry in the .ind
file:
\item \T2A\CYRD \T2A\cyro \T2A\cyrz , \hyperpage{224}
In turn it is generated by the following entry in the .idx
file:
\indexentry{\T2A\CYRD \T2A\cyro \T2A\cyrz |hyperpage}{224}
If I switch memoir
to article
or book
then the index contains the entries defined in the document verbatim, without them being encoded.
The following MWE can be used to validate:
\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1,T2A]{fontenc}
\usepackage[main=russian]{babel}
\usepackage{lipsum}
\usepackage{makeidx}
\makeindex
\newcommand{\rindex}[1]{\expandafter\index\expandafter{\detokenize{#1}}}
\begin{document}
жзи\rindex{жзи}
\clearpage
где\rindex{где}
\clearpage
абв\rindex{абв}
\clearpage
эюя\rindex{эюя}
\clearpage
шщы\rindex{шщы}
\clearpage
клм\rindex{клм}
\printindex
\end{document}
It passes the 1st pass, then command texindy -L russian -C utf8 "document.idx"
generates the .ind
file, and the 2nd pass fails.
LaTeX2e <2019-10-01> patch level 3
and get\indexentry{жзи}{1}
etc. in the.idx
file. I think I remember that LaTeX 2019-10-01 brought great improvements for Unicode handling in pdfLateX in some areas. Alternatively it might be a good idea to switch to a Unicode engine like XeLaTeX or LuaLaTeX.\usepackage[xindy]{imakeidx}