I am typesetting a Hindi book with multiple indexes and Devanagari chapter/section/page numbers. I want to use HarfBuzz rendering with LuaLaTeX, which enables error-free copy-pasting of Devanagari text from PDFs as discussed here. Unfortunately HarfBuzz rendering with XeLaTeX does not give the desired results. So I have to use LuaLaTeX. I tried an example with LuaLaTeX compiler from TexLive 2020 (on Overleaf).
This is my latexmkrc file.
add_cus_dep( 'adx', 'and', 0, 'ndx2nnd' );
sub ndx2nnd {return system( "makeindex -o \"$_[0].and\" \"$_[0].adx\"" );}
push @generated_exts, 'adx', 'and';
Attempt 1: With polyglossia
The following file compiles fine with LuaLaTeX and gives me two indexes, but with Western Arabic chapter/section/page numbers. This seems to be a known issue here.
\documentclass[twoside]{book}
\usepackage{polyglossia}
\setmainlanguage{hindi}
\newfontfamily\devanagarifont[Renderer=HarfBuzz,Script=Devanagari,Mapping=devanagarinumerals]{Noto Serif Devanagari}
\newfontfamily\englishfont{Noto Serif}
\usepackage{index}
\makeindex
\newindex{top}{adx}{and}{विषयसूची}
\newindex{aut}{adx}{and}{लेखकसूची}
\begin{document}
\chapter{प्रस्तावना}
\section{परिचय}
हम किंकर्तव्यविमूढ हैं।
\index[top]{विषय १}
\index[aut]{लेखक १}
\printindex[top]
\printindex[aut]
\end{document}
Attempt 2: With babel
The following file compiles fine with LuaLaTeX and gives me Devanagari chapter/section/page numbers, but no index.
\documentclass[twoside]{book}
\usepackage{babel}
\usepackage{fontspec}
\babelprovide[mapdigits,maparabic,main]{hindi}
\defaultfontfeatures{Renderer=Harfbuzz,Script=Devanagari}
\babelfont{rm}{Noto Serif Devanagari}
\usepackage{index}
\makeindex
\newindex{top}{adx}{and}{विषयसूची}
\newindex{aut}{adx}{and}{लेखकसूची}
\renewcommand\hindichaptername{अध्याय}
\begin{document}
\chapter{प्रस्तावना}
\section{परिचय}
हम किंकर्तव्यविमूढ हैं।
\index[top]{विषय १}
\index[aut]{लेखक १}
\printindex[top]
\printindex[aut]
\end{document}
I can use either polyglossia or babel, would prefer polyglossia. So appreciate any help to make either of the two examples above work. The one with polyglossia is missing Devanagari numbers and the one with babel is missing the two indexes.
babelversion fails because page numbers are converted at the TeX level (withmaparabic) to the Devanagari forms, whichmakeindexdoesn't understand. Isn'tmapdigitsenough? At least with this example the result seems fine if I removemaparabic. – Javier Bezos May 29 '21 at 09:52.adxfile. Use different file extensions for each index: like.and,.adx,.tdx,.tnd. (b)fontspec's mapping (as called bypolyglossiaonly works in xelatex; lualatex has an error message in the log. – Cicada May 29 '21 at 10:52