LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and AcronymsInstalling Xindy in MikteX

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
Posts: 6
Joined: Wed Jul 08, 2009 9:38 pm

Installing Xindy in MikteX

Postby lartkma » Thu Jul 09, 2009 2:50 am

EDIT: Finally, Xindy works! I upload the files and the installer in this post.


I discovered Xindy recently. I want to install it because, as a Spanish LaTeX user, is very useful to have a tool what permits to write indexes with a correct handling of accents and tildes.

Unfortunately, the program is only in Linux (officially). I heard that there are Windows binaries, specifically in the TeXLive distro. But it is mixed with the rest of files.

Finally, I found the Windows binary files (separately) in the page of W32TeX. The files are available here.

At unzip, there are two folders: bin and share, this latter has one folder, texmf, and this has three folders: doc, scripts and xindy. The two first have a xindy folder.

First, I put this files in my MikTeX main folder (C:/Archivos de programa/MiKTeX 2.7) in the following way:
  • The binaries (xindy, texindy) found in the bin folder, go to the /miktex/bin folder, along with latex, bibtex, makeindex, etc.
  • The xindy folders in doc and scripts, go to the MikTeX doc and scripts folder, respectively.
  • The standalone xindy folder (into texmf), goes to the main folder.
#NOTE: "Archivos de Programa" is the Spanish equivalent of "Program Files"

Having done this, I run xindy. The first problem occurs. I have a message:
warning: kpathsea: configuration file texmf.cnf not found in these directories: C:/Archivos de programa/MiKTeX 2.7/miktex/bin;C:/Archivos de programa/MiKTeX 2.7/miktex;C:/Archivos de programa/MiKTeX 2.7; [a list of directories...].
Failed to find script.

I discovered that distros like TeXLive use a file called texmf.cnf for saving the general configuration, while MikTeX uses a file called miktex.ini.

Fortunately, I have a TeXLive distro in a DVD. I copy the texmf.cnf file from the /texmf/web2c folder, and I put the file in the MikTeX main folder.

I run xindy again. The following message appears:
Failed to find script.

I expected it. The problem is that, when reading the file, folders are configured differently from the way that MiKTeX does. So, I think that ,if I modify texmf.cnf so that it points to the correct folders, xindy could work.

I open the texmf.cnf file, and modify the path variables: TEXMFMAIN, TEXMFDIST, etc.

I upload the modified file to J.ot Down, so you can view and modify it.

With the texmf.cnf file modified, I run xindy. But a new problem occurs. The following message appears:
Script interpreter is not found in PATH.

Apparently found the files, but what is the "Script interpreter"? Where I get it? There is an alternative?

I need help. It's almost ready!
But don't tell me I have to install TeXLive :(
Last edited by lartkma on Fri Jul 17, 2009 3:55 am, edited 2 times in total.

Posts: 6
Joined: Wed Jul 08, 2009 9:38 pm

Postby lartkma » Sat Jul 11, 2009 10:50 pm

Hi, again.

I discovered that the "Script interpreter" is a Perl Interpreter. Xindy works with a Perl script,

Initially I did not want to install a full Perl system on my PC (like ActivePerl or similar), because i want to get a minimal system (I don't want to program in Perl). Then, I searched the TeXLive's Perl interpreter (because he has a functional Xindy, isn't it?).

I found it in the tlperl folder (the bin and the libraries). I copy the folder and I paste it in my MikTeX main folder. Later, I add the Perl interpreter path in my PATH system variable.

I run Xindy. But the following message appears:
Can't open perl script "C:/Archivos": No such file of directory

The problem: Perl interprets whitespace as a separator of arguments (in C:/Archivos de programa/MiKTeX 2.7, there are a "C:/Archivos" argument, a "de" argument, and so on). In order to accept this, the path must be passed quotated. But if I put the quotes in texmf.cnf, kpathsea will not work...

After several attempts, I found the solution: the DOS names. They are a valid mode for call paths in Windows, and they don't have whitespaces. Then, I modified texmf.cnf, replacing the line
MIKTEXMAIN = C:/Archivos de programa/MiKTeX 2.7

So, I run xindy, and feel that I am closer and closer, because the following message appeared: Cannot locate xindy modules directory at c:/ARCHIV~1/MIKTEX~1.7/scripts/xindy/ line 341.
BEGIN failed--compilation aborted at c:/ARCHIV~1/MIKTEX~1.7/scripts/xindy/ line 346.

Now it's the script itself.
I open, and I go to the line 341. I found a code for searching, among alternatives, the module directory (where the styles and rules are). Exactly:
  1. # modules directory
  2. if ( -d "$cmd_dir/../modules" ) { # /opt style
  3. $modules_dir = "$cmd_dir/../modules";
  4. } elsif ( -d "$lib_dir/modules" ) { # /usr style
  5. $modules_dir = "$lib_dir/modules";
  6. } elsif ( -d "$lib_dir/../../texmf/xindy" ) { # texlive multiplatform style
  7. $modules_dir = "$lib_dir/../../texmf/xindy";
  8. } elsif ( -d "$lib_dir/../texmf/xindy" ) { # texlive non-multiplatform style
  9. $modules_dir = "$lib_dir/../texmf/xindy";
  10. } elsif ( -d "$lib_dir/../share/texmf/xindy" ) { # w32tex
  11. $modules_dir = "$lib_dir/../share/texmf/xindy";
  12. } elsif ( -d "/usr/share/xindy" ) { # FSH style
  13. $modules_dir = "/usr/share/xindy";
  14. } else {
  15. die "$cmd: Cannot locate xindy modules directory";
  16. }

But no one match with the MikTeX style. So, I added a new condition for searching. After the #w32tex condition, I write this code:
  1. } elsif ( -d "$lib_dir/../../xindy" ) { # miktex
  2. $modules_dir = "$lib_dir/../../xindy";

I save the changes, and finally, I run xindy again.
Well, really, what I was calling was "xindy -?" :P

For that reason, I must do a test with an real LaTeX file to generate a index. If all goes well, I will write a post with the files needed for installation.

Posts: 6
Joined: Wed Jul 08, 2009 9:38 pm

Postby lartkma » Tue Jul 14, 2009 2:15 am

Hi, again.

I made a sample LaTeX file to create an index. The document, indice.tex, is written in Spanish.
  1. \documentclass{article}
  2. \usepackage[spanish]{babel}
  3. \usepackage[latin1]{inputenc}
  4. \usepackage{makeidx}
  5. \makeindex
  7. \begin{document}
  9. El abeto\index{abeto} es un árbol\index{árbol}. El chopo\index{chopo} y el cerezo\index{cerezo} también lo son.
  10. \printindex
  12. \end{document}
#NOTE: The example is taken form here

First, I compile the document with latex indice.tex, in order to obtain the indice.idx file, that has the index entries information.

Now, I process the .idx file with xindy, calling to texindy (the LaTeX wrapper of xindy) in this way: texindy -L spanish-modern indice.idx

The following error message appears:
"C:/Archivos" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable.
Opening logfile ".\\indice.ilg" <done>
Reading indexstyle...
Loading module "C:\\DOCUME~1\\User\\CONFIG~1\\Temp\\[random letters]"

Error in line 1:
<require "">
ERROR: "" is not a valid filename !
#NOTE: The first paragraph (in Spanish) says: "C:/Archivos" is not recognized as an internal or external command, operable program or batch file.

When I saw the first paragraph, I thought "oh no, the pass-to-shell-a-folder-with-blank-spaces problem again". I made a debug with the -d script option. As expected, the "Running filter" and "Found language module" lines in the console show the problem.

I open and found that the filter function receives a path $filter_cmd that depends of a variable called $cmd_dir. This variable starts taking the value of the path where the script itself is (C:/Archivos de programa/MiKTeX 2.7/scripts/xindy in this case).

The good news are that this value is written with the DOS names of folders. The bad news are that, in one case (which is this case) this variable changes, and takes the value of $ENV{"SELFAUTOLOC"}, which is the MiKTeX binaries folder, but don't have the DOS folder names and, in this case, have whitespaces.

I modified the code so that, if we have a MiKTeX distribution, the script back in the original path in two folders, to the MiKTeX main folder. From here go to the binaries folder.

I replace
  1. } elsif ( exists $ENV{"SELFAUTOLOC"} && -f "$ENV{SELFAUTOLOC}/$xindy_run" ) { # texlive woe32
  2. $lib_dir = $ENV{"SELFAUTOLOC"};
  3. $cmd_dir = $ENV{"SELFAUTOLOC"};
  1. } elsif ( exists $ENV{"SELFAUTOLOC"} && -f "$ENV{SELFAUTOLOC}/$xindy_run" ) { # texlive woe32
  2. if (index(lc($ENV{"SELFAUTOLOC"}),"miktex") != -1){ #miktex
  3. $lib_dir = "$cmd_dir/../../miktex/bin";
  4. $cmd_dir = "$cmd_dir/../../miktex/bin";
  5. } else {
  6. $lib_dir = $ENV{"SELFAUTOLOC"};
  7. $cmd_dir = $ENV{"SELFAUTOLOC"};
  8. }

I run texindy on indice.idx, and works! Xindy generates the index file, indice.ind. I run latex on indice.tex again for process the .ind file. I open the .dvi output, and I can see the index!
The next step is upload the whole files in a package. I will do a autoinstaller for copy and paste the folders in the right place. When I finished, it will be in download.

Please, if you have errors with xindy when install the package, reply in this post for correct the files.

Bye for now!

Posts: 1
Joined: Mon Feb 14, 2011 5:49 pm

Postby dsplayer » Tue Feb 15, 2011 2:38 pm

The presented approach did not work here. I tried following steps instead. The do not work either!

1. Install xindy-w32 using xindy-win.exe. I chose c:\MiKTeX29 as installation directory. C:\MiKTeX29 is my MiKTeX installation directory.
xindy-win.exe is derived from xindy-w32 available at

DO NOT UNINSTALL xindy-win.exe afterwards: Your whole MiKTeX directory will be deleted!

2. replace C:\MiKTex29\miktex\bin\texindy.exe with texindy.bat having follwing content:
  1. @echo off
  2. SET SELFAUTOLOC=C:\MiKTeX29\miktex\bin
  3. perl C:\MiKTeX29\scripts\xindy\ %1 %2 %3 %4 %5 %6 %7 %8 %9

3. xindy.exe does not work
Now the handover from xindy.exe to xindy-lisp.exe does not work:
command: c:/MiKTeX29/scripts/xindy/../../miktex/bin/xindy-lisp.exe -q -B c:/MiKTeX29/scripts/xindy/../../miktex/bin -M c:/MiKTeX29/scripts/xindy/../../miktex/bin/xindy.mem -E iso-8859-1 /tmp/6g9e5HHrPu
*** - LOAD: A file with name \tmp\6g9e5HHrPu does not exist

Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 1 guest