# Xindy (imakeidx, XeLaTeX) not sorting correctly

Being new to LaTeX, I would appreciate help on this particular problem.

Somehow xindy does not recognise languages on my system. I am on Windows, have a recently downloaded MiKTeX 2.9, use TexMaker, run XeLaTeX (tried both with and without --shell-escape / --enable-write18 option), all my .xdy files for languages seem to be in place, no warning or error is issued, but no matter which language I switch to, the sorting comes out wrong. Note that with XeLaTeX I cannot use inputenc.

Here is my MWE:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{polyglossia}
\setdefaultlanguage{croatian}
\setmainfont{Cambria}

\usepackage{imakeidx}
\makeindex[columns=1]

\begin{document}

avion\index{avion}
buka\index{buka}
cura\index{cura}
čarapa\index{čarapa}
dug\index{dug}
džem\index{džem}
nos\index{nos}
nježan\index{nježan}

\printindex

\end{document}


This is what I get:

So, the accented letter is placed under 'A'. When I turn the xindy option off, I get this:

This time it placed the accented letter at the end of the alphabet.

In Croatian, 'č' is a separate letter, so it has to be listed under its own heading, while 'dž' and 'nj' are compound letters that should stand after 'd' and 'n', respectively.

What I want to get is sorting like this:

A

avion

B

buka

C

cura

Č

čarapa

D

dug

džem

N

nos

Nj

nježan

The same thing if I use Czech, or Spanish (e.g. ñ) - they just don't group correctly in the index. Is there a simple solution to this? Thank you for your help.

You have to pass Xindy the language options. Run with xelatex -shell-escape

\documentclass{article}

\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage[xindy]{imakeidx}

\setdefaultlanguage{croatian}

\makeindex[columns=1,options=-M texindy -L croatian -C utf8]

\begin{document}

avion\index{avion}
buka\index{buka}
cura\index{cura}
čarapa\index{čarapa}
dug\index{dug}
džem\index{džem}
nos\index{nos}
nježan\index{nježan}

\printindex

\end{document}


• I have realized that I can enforce pdflatex to run xindy specifying \makeindex[program=texindy,options=-M texindy -L croatian -C utf8]. However the problem is that IDX and IND should be in another folder than TEX file; i.e. "build\name.idx" and "build\name.ind". Is there any solution to send texindy this information? – Pygmalion Nov 29 '18 at 17:47
• @Pygmalion I recommend not using separate directories for auxiliary files and now you can understand why. – egreg Nov 29 '18 at 18:12
• Hm, in the end I do need to write a batch file anyway, because I must replace |hyperindexformat{\sees that cannot be digested by xindy. To bad that the language setting cannot be passed from pdflatex to xindy within index.idx, so I have to create batch files for each language separately. – Pygmalion Nov 30 '18 at 7:47