# How to use Xindy with MiKTeX?

Obsolete since end of June, 2015.

As probably widely is known, the indexing tool Xindy is not included in the TeX distribution MiKTeX. Because MakeIndex does not work well with Unicode, but Xindy does, I therefore have a question:

Could Xindy installed by hand, and, if yes, how could this be done?

My following answer is obsolete since end of June, 2015. I’ve got the internal MiKTeX version with the update from 25 of June 2015, but apparently others got it already one week earlier.

Note, that for now there is an issue, if you’ve installed MiKTeX into a path containing spaces – as it is the default, when you used the C:\\Program Files\ or C:\\Program Files (x86)\ system folders. See wolfi’s answer to the according question MiKTeX and Xindy problems .

Yes, it is possible.

Remark: Several posts have been made to LaTeX-Community.org – see Installing Xindy in MikteX and finally Xindy for MiKTeX, but you will find some issues there. First, the user “lartkma” provided some files, which were uploaded to Megaupload.com, but this service is down for known reasons (see Megaupload legal case on Wikipedia). Second, I strongly discourage his advice on how to install Xindy into the main MiKTeX installation path. I wrote about this in my answer to Purpose of local texmf trees. But in the end all following instructions are still derived from lartkma’s work.

More recently a feature request has been made to include xindy in MikTeX, which also includes detailed, up-to-date installation advice.

Prerequisite: You need a Perl interpreter – you need it anyway for the Perl scripts in MiKTeX, cf. my answer to MiKTeX and Perl scripts for advices.

If Perl is properly installed, follow the directions!

1. If you didn’t already have created a local texmf path, do it now. See Create a local texmf tree in MiKTeX.

For Xindy you will need this structure:

<localtexmf>
|
|--doc
|   |
|   +--xindy
|
|--miktex
|   |
|   +--bin
|
|--scripts
|     |
|     +--xindy
|
+--xindy
|
+--modules


Don't forget to add the folder <localtexmf>\miktex\bin to the system variable Path in Windows.

Nota bene: In earlier versions of this answer the recommended binary path was <localtexmf>\bin, and I personally still prefer this path. What I actually did – and want to give as advice to you – was that I created a symbolic link from <localtexmf>\miktex\bin to <localtexmf>\bin, and I did not add the new link to the system path variable. Cf. also Wikipedia: Symbolic link in Microsoft Windows. As long as you are on the same drive it does not matter, whether you use a soft link or a junction (see also on Superuser.com: directory junction vs directory symbolic link?). BTW instead of Microsoft’s own command line tools I prefer Link Shell Extension.

2. Get the Xindy package provided by W32TeX: http://mirror.ctan.org/systems/win32/w32tex/xindy-w32.tar.xz – this file contains all you need.

Remark: Ensure the date of the file is 16.4.2014 or later. The file tex2xindy.exe in the bin folder should have a date of 14.4.2014 or later. If unsure download directly from the W32TeX website.

3. Extract all files into a temporary folder. You need a program, which can unpack XZ files (and also TAR, but that’s common). My suggestion is 7-Zip or PeaZip.

The files tex2xindy.exe, xindy.mem, and xindy-list.exe from the bin folder go into <localtexmf>\miktex\bin (the two .dll-files and the other two .exe-files and are not needed anymore), all contents of share\texmf-dist\doc go into <localtexmf>\doc and so on for the others.

4. If you’ve copied the files xindy.exe and texindy.exe into <localtexmf>\miktex\bin, delete them.

In the <localtexmf>\miktex\bin folder create two empty text files with the names xindy.bat and texindy.bat. If you like this more, you can also choose .cmd as file extension, but the filenames must not be changed!

Copy the following lines into xindy.bat and adjust the script path to your settings:

@echo off
set ScriptPath=<localtexmf>\scripts\xindy
perl %ScriptPath%\xindy.pl %*


For texindy.bat the content must be slightly different, of course:

@echo off
set ScriptPath=<localtexmf>\scripts\xindy
perl %ScriptPath%\texindy.pl %*


Remark: The second and third line could be merged in both cases, but in my opinion the above version is far more readable.

If you use the default text editor Notepad, in the save dialogue make sure, that you do not save to a file with .txt extension: Save with double quotes "xindy.bat".

5. Refresh your filename data base (FNDB). How to do, is (for instance) also described in Create a local texmf tree in MiKTeX.

6. In your favorite TeX editor you perhaps need to add a call to Xindy. Because this is different for every editor, I cannot write anything about this here.

Happy Indexing!

Here two test cases, in your favorite task manager you will see the execution of perl.exe and xindy-lisp.exe:

• Creating an index:

For convenience I used the package imakeidx, because with the option xindy you get there an automatic call to Xindy (actually it’s texindy!) without any configuration, but for this you must first add the switch --enable-write18 to the call of pdflatex (or the alias --shell-escape).
Note, with texifyit’s a bit different: --tex-option="--enable-write18".

\documentclass{article}
\usepackage[latin,english]{babel} % needed for "blindtext",
% "english" is the active language
\usepackage{blindtext,lipsum,kantlipsum}

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

\begin{document}

\section*{Package \texttt{blindtext}}

\subsection*{English blindtext}\index{blindtext (package)!english}
%%% see below before section "kantlipsum" for
%%% \index{blindtext (package)!english|seealso{kantlipsum}}
\blindtext[1]

\subsection*{Latin blindtext}\index{blindtext (package)!latin}
%%% see below before section "kantlipsum" for
%%% \index{blindtext (package)!latin|seealso{lipsum}}
{\selectlanguage{latin}% note the grouping
\blindtext[1]}

\newpage

\index{blindtext (package)!english|seealso{kantlipsum}}
\index{blindtext (package)!latin|seealso{lipsum}}

\section*{Package \texttt{kantlipsum}}\index{kantlipsum}
%%% see below before "\printindex" for
%%% \index{kantlipsum|seealso{blindtext (package) with english option}}
\kant[123]

\section*{Package \texttt{lipsum}}\index{lipsum}
%%% see below before "\printindex" for
%%% \index{lipsum|seealso{blindtext (package) with latin option}}
{\selectlanguage{latin}% actually not needed here
\lipsum[123]}% note the grouping again

\newpage

\index{kantlipsum|seealso{blindtext (package) with english option}}
\index{lipsum|seealso{blindtext (package) with latin option}}

\printindex

\end{document}

• Creating a glossary with package glossaries:

testfile.tex:

\documentclass{article}

\usepackage[xindy]{glossaries}
\makeglossaries

\newglossaryentry{gloss}{
name=glossaries,
description=A package for generating glossaries in many styles
}

\begin{document}

\texttt{\gls{gloss}} is a great package!

\printglossaries
\end{document}


After one latex compilation, run makeglossaries testfile on command line. With options and filename above this will in background make a call of

xindy -L english -I xindy -M "testfile" -t "testfile.glg" -o "testfile.gls" "testfile.glo"

After a second latex run you should see the result. For other settings you must read the documentation of glossaries.

• @Qrrbrbirlbel: Adding the bin subfolder to the system path is mentioned above. For the other issue I can only assume, that you have a different directory structure and hence have to edit xindy.plin another way. Or you've forgotten to add %userprofile%\localtexmf to the MiKTeX roots. Or it’s a user right issue, where I can’t help at all. Or … no , no more ideas. – Speravir Oct 15 '12 at 15:00
• I guess, this is a “space in path” problem. But still, when I call perl "C:\Users\<username in 8.3>\localtexmf\scripts\xindy\xindy.pl" xindy.idx, I get: XINDY:STARTUP: keyword arguments in (:IDXSTYLE :RAWINDEX "A0OuxZfRbA" :OUTPUT "xindy.ind" :LOGFILE "nul") should occur pairwise. (Moving localtexmf to a no-space path didn't help either.) Update: texindy.pl works! texindy.exe still doesn't fails to find script. I will invest further research in all those pahts. – Qrrbrbirlbel Oct 15 '12 at 15:57
• With the example I’ve given? But this seems to be beyond my horizon. Perhaps an own question? – Speravir Oct 15 '12 at 16:08
• Yes. Doesn't texindy start xindy on its own? Anyway, first job is getting the .exe to work … I probably won't invest any time now because I currently do not work on a document that requires a comprehensive index. – Qrrbrbirlbel Oct 15 '12 at 16:17
• @nnunes: Thank you for your edits. I did not have time (and leisusure) to do this on my own. I added now another remark regarding the binary path. – Speravir Jul 30 '14 at 18:32

Since June 2015, xindy is available for installation in miktex package manager. See version 5653 of the package repository.

Don't forget to update database.

There has been made a very easy xindy installer for Windows.

Look at the entry in LaTeX Wikibook: Compile glossary with xindy - In Windows with Texmaker.

Remark by Speravir, originally in a deleted comment:
I cannot recommend this installation: It installs deprecated versions of xindy and Perl. When you want to perform a xindy update, you must very probably install a full Perl distribution anyway.

• I loaded the installer , but it didn't work neither with the perl script, nor with exe files (probably a problem in a perl script with an environment variable – one of the exe supposed thatxindy-lisp.exe was in LocalTeXMF, not in an independent xindy directory. – Bernard Jul 15 '13 at 12:59