# Why do you need (to use) texindy (to call xindy) when you want to use xindy?

If I replace the word `texindy` with `xindy` in the following answer the code compiles and produces same output (at least using TeXShop). `texindy` is there for a reason, and at least one expert uses it instead of using `xindy` directly. (See the comments after the answer.)

What can go wrong (in what situations) if I use `xindy` directly without using `texindy` to call it?

-

Here's an excerpt from the `xindy` man page (boldface and italics in the original (formatted) source):

xindy is the formatter-independent command of xindy, the flexible indexing system. It takes a raw index as input, and produces a merged, sorted and tagged index. Merging, sorting, and tagging is controlled by xindy style files. ...

If you want to produce an index for LaTeX documents, the command texindy (1) is probably more of interest for you. It is a wrapper for xindy that turns on many LaTeX conventions by default.

I interpret this as indicating that whereas xindy is (largely) formatter-independent, texindy is better suited for use with LaTeX documents since it knows about LaTeX's formatting-related and other conventions.

Of course, for sufficiently simple LaTeX documents and indexation requirements, the output of the two commands may well be indistinguishable. Not knowing how complicated your LaTeX document is, it's not possible to answer your question as to what "might go wrong" if you used `xindy` instead of `texindy`. For more information on the `xindy` and `texindy` commands, see the respective man pages -- which can be brought up, say, via `texdoc xindy` and `texdoc texindy`.

-
Thanks. It would be nice to see at least one counterexample. – Sony Jan 2 '12 at 19:05
The last version of `imakeidx` has a `realxindy` option; unfortunately we decided at the beginning to make `xindy` as a synonym for `texindy`, which was a bad decision. :( – egreg May 8 '13 at 15:52
I think `xindy` cannot read `idx` files, it's input format is based on lisp. AFAIK, `texindy` calls `tex2xindy` which convert LaTeX index format to format `xindy` understands and then it call xindy with some supporting modules – michal.h21 May 8 '13 at 15:56

I haven't used Xindy yet, but the following might be one advantage of using texindy instead of xindy. From Xindy revisited: Multi-lingual index creation for the UTF-8 age:

At the moment, the most often used encoding for raw index files is the LATEX output of \index commands. That encodes non-ASCII characters as macros; the representation is called LATEX Internal Character Representation or LICR, as described in section 7.11 of The LATEX Companion, 2nd ed. Xindy knows about LICR: xindy modules exist with merge rules to recognize these character representations. A special invocation command for LATEX, texindy, picks them up automatically, so authors have no need to think about them.

PS: I would have just posted a comment, but my reputation is too low...

-
Note: if source document is first processed with `xelatex` instead of `pdflatex`, resulting `.idx ` file keeps non-ASCII characters as UTF-8 instead of transforming them to macros. So there should be no issues with`xindy` as far as encoding is concerned when using `xelatex`. – Rafal Aug 4 '15 at 8:53