MakeIndex, Nomenclature, Glossaries and AcronymsInstalling Xindy in MikteX

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

Installing Xindy in MikteX

Post by lartkma »

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

Hi.

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.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
lartkma
Posts: 6
Joined: Wed Jul 08, 2009 9:38 pm

Installing Xindy in MikteX

Post by lartkma »

Hi, again.

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

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
for
MIKTEXMAIN = C:/ARCHIV~1/MIKTEX~1.7
So, I run xindy, and feel that I am closer and closer, because the following message appeared:
xindy.pl: Cannot locate xindy modules directory at c:/ARCHIV~1/MIKTEX~1.7/scripts/xindy/xindy.pl line 341.
BEGIN failed--compilation aborted at c:/ARCHIV~1/MIKTEX~1.7/scripts/xindy/xindy.pl line 346.
Now it's the script itself.
I open xindy.pl, 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:

Code: Select all

 # modules directory
    if ( -d "$cmd_dir/../modules" ) {	# /opt style
	$modules_dir = "$cmd_dir/../modules";
    } elsif ( -d "$lib_dir/modules" ) {	# /usr style
	$modules_dir = "$lib_dir/modules";
    } elsif ( -d "$lib_dir/../../texmf/xindy" ) { # texlive multiplatform style
	$modules_dir = "$lib_dir/../../texmf/xindy";
    } elsif ( -d "$lib_dir/../texmf/xindy" ) { # texlive non-multiplatform style
	$modules_dir = "$lib_dir/../texmf/xindy";
    } elsif ( -d "$lib_dir/../share/texmf/xindy" ) { # w32tex
	$modules_dir = "$lib_dir/../share/texmf/xindy";
    } elsif ( -d "/usr/share/xindy" ) { # FSH style
	$modules_dir = "/usr/share/xindy";
    } else {
	die "$cmd: Cannot locate xindy modules directory";
    }
But no one match with the MikTeX style. So, I added a new condition for searching. After the #w32tex condition, I write this code:

Code: Select all

    } elsif ( -d "$lib_dir/../../xindy" ) { # miktex
	$modules_dir = "$lib_dir/../../xindy";
I save the changes, and finally, I run xindy again.
AND WORKS!!!
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.
lartkma
Posts: 6
Joined: Wed Jul 08, 2009 9:38 pm

Installing Xindy in MikteX

Post by lartkma »

Hi, again.

I made a sample LaTeX file to create an index. The document, indice.tex, is written in Spanish.

Code: Select all

\documentclass{article}
\usepackage[spanish]{babel}
\usepackage[latin1]{inputenc}
\usepackage{makeidx}
\makeindex

\begin{document}

El abeto\index{abeto} es un árbol\index{árbol}. El chopo\index{chopo} y el cerezo\index{cerezo} también lo son.
\printindex

\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 xindy.pl 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

Code: Select all

} elsif ( exists $ENV{"SELFAUTOLOC"} && -f "$ENV{SELFAUTOLOC}/$xindy_run" ) { # texlive woe32
	$lib_dir = $ENV{"SELFAUTOLOC"};
	$cmd_dir = $ENV{"SELFAUTOLOC"};
with

Code: Select all

} elsif ( exists $ENV{"SELFAUTOLOC"} && -f "$ENV{SELFAUTOLOC}/$xindy_run" ) { # texlive woe32
	if (index(lc($ENV{"SELFAUTOLOC"}),"miktex") != -1){   #miktex
	    $lib_dir = "$cmd_dir/../../miktex/bin";
	    $cmd_dir = "$cmd_dir/../../miktex/bin";
	} else {
	    $lib_dir = $ENV{"SELFAUTOLOC"};
	    $cmd_dir = $ENV{"SELFAUTOLOC"};
	}
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!
XINDY IS ALIVE!
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!
dsplayer
Posts: 1
Joined: Mon Feb 14, 2011 5:49 pm

Installing Xindy in MikteX

Post by dsplayer »

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 http://w32tex.org/.

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:

Code: Select all

@echo off
SET SELFAUTOLOC=C:\MiKTeX29\miktex\bin
perl C:\MiKTeX29\scripts\xindy\texindy.pl %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
Courtney McDaniel
Posts: 7
Joined: Mon Apr 16, 2018 11:04 am

Installing Xindy in MikteX

Post by Courtney McDaniel »

Oh my god, I already think that this problem will forever haunt me, so much effort and doesn`t work anyway ...
Post Reply