According to Xindy revisited: Multi-lingual index creation for the UTF-8 age (TUGboat), “if one has a raw index file that was produced by [XeTeX], one can use xindy; it will ‘just work’.”

Unfortunately I can't get it to “just work”. How can I use Xindy together with XeLaTeX or LuaLaTeX?

An example LaTeX file:



The LaTeX Companion (2ed) then tells me to run

texindy -L german-duden test.idx

However when I do this all umlauts are sorted under O.


Based on Ulrike's answer, here is one way to invoke xindy to get it to sort .idx files created by Xe/LuaLaTeX. The trick is to use xindy directly (instead of texindy) and pass the -C utf8 flag.

Minimal Example





lualatex filename.tex
xindy -M texindy -C utf8 -L german-duden filename.idx 
lualatex filename.tex

In (pdf)latex you can use UTF-8 encoding and xindy in the following way:



And then simply run texindy -L ⟨language⟩ ⟨filename⟩.idx.

In LuaTeX you can also use the luainputenc package to use legacy encodings.



Again, run texindy -L ⟨language⟩ ⟨filename⟩.idx.

Here the result for both examples:


  • 1
    As I said, I want to compile with XeTeX or LuaTeX. Both of those provide UTF-8 by default and don't use any inputenc/fontenc ”hacks” to support the encoding. So this won't work. – Caramdir Aug 15 '11 at 16:55
  • The problem here is, that the .idx file created by pdflatex isn't actual unicode, but contains LaTeX-encoded umlauts (etc.). In comparison the modern engines create fully unicode-encoded .idx files. xindy is supposed to support this, I just don't know how. – Caramdir Aug 15 '11 at 16:58
  • 1
    I does work with the luainputenc hack. Still I'd prefer a solution that uses Unicode throughout. While the solution works in this case, something like \index{α} would still cause trouble. – Caramdir Aug 15 '11 at 17:11
  • 2
    @Caramdir: It is not surprising that fontspec + luainputenc works: fontspec loads xunicode which gives most of the standard commands (\" etc) senseful definitions. But having to use luainputenc should not be necessary. After all one point of xindy is to get real utf8 support. – Ulrike Fischer Aug 15 '11 at 19:19
  • 1
    I changed your answer a bit, so that it is more helpful for people coming here from google who didn't follow how the answer came to be (this question is currently the top result for a search for lualatex xindy). – Caramdir Aug 17 '11 at 17:15

here is an example with an own style file for xindy. Run it with

lualatex <file>
xindy -C utf8 -I latex -M myModuleE <file>.idx
lualatex <file>

then I get the attached output

(define-attributes ("default"))
(define-location-class "page-numbers" ("arabic-numbers"))
(markup-index :open  "~n\begin{theindex}~n"
              :close "~n\end{theindex}~n"
(markup-locclass-list :open "\quad{}")
(markup-locref-list   :sep ", ")
(markup-indexentry :open "~n  \item "           :depth 0)
( define-letter-group "A--D" :prefixes ("A" "B" "C" "D") )
( define-letter-group "E--G" :after "A--D" :prefixes ("E" "F" "G") )
( define-letter-group "H--K" :after "E--G" :prefixes ("H" "I" "J" "K") )
( define-letter-group "L--N" :after "H--K" :prefixes ("L" "M" "N" ) )
( define-letter-group "O--R" :after "L--N" :prefixes ("O" "P" "Q" "R") )
( define-letter-group "S--V" :after "O--R" :prefixes ("S" "T" "U" "V") )
( define-letter-group "W--Z" :after "S--V" :prefixes ("W" "X" "Y" "Z") )
(sort-rule "a" "A")
(sort-rule "b" "B")
(sort-rule "c" "C")
(sort-rule "d" "D")
(sort-rule "e" "E")
(sort-rule "f" "F")
(sort-rule "g" "G")
(sort-rule "h" "H")
(sort-rule "i" "I")
(sort-rule "j" "J")
(sort-rule "k" "K")
(sort-rule "l" "L")
(sort-rule "m" "M")
(sort-rule "n" "N")
(sort-rule "o" "O")
(sort-rule "p" "P")
(sort-rule "q" "Q")
(sort-rule "r" "R")
(sort-rule "s" "S")
(sort-rule "t" "T")
(sort-rule "u" "U")
(sort-rule "v" "V")
(sort-rule "w" "W")
(sort-rule "x" "X")
(sort-rule "y" "Y")
(sort-rule "z" "Z")
(markup-letter-group-list :sep "~n\indexspace")
(sort-rule "Ä" "A")
(sort-rule "ä" "A")
(sort-rule "Ö" "O")
(sort-rule "ö" "O")
(sort-rule "Ü" "U")
(sort-rule "ü" "U")
(merge-rule "\\[a-zA-Z@]+ *" "" :eregexp)
(merge-rule "\\[^a-zA-Z@]" "" :eregexp)
(merge-rule "^[{}$]" "" :eregexp)
  {\raggedright\small\let\item\@idxitem \parskip .0pt\@plus .3\p@\relax
% xindy -C utf8 -I latex -M myModuleE datei.idx
\printindex     \newpage  foo \index{ä}\index{ü}
\index{Aal}   \index{Berg}\index{Cäsar}
\index{Donau} \index{Emil}\index{Flora}

enter image description here


I don't have a working xindy. But according to this message http://sourceforge.net/mailarchive/message.php?msg_id=26841124 I think you need at least the option -C utf8 and perhaps also a new xindy style.

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.