Everything was working perfectly. Suddenly I started getting the error for xindy
while using the glossaries
package
Warning: File 'PhDThesis.acn' is empty. Have you used any entries defined in glossary 'acronym'?
***Call to xindy failed*** Possible cause of problem: Sort key required for entries only containing command names Check 'PhDThesis.nlg' for details
I had just updated my Ubuntu 12.10.
The content of the .nlg file
;; This logfile was generated automatically by `xindy'
;; at 14.08.2013 17:25:07
;; Indexstyle: "/tmp/HCmyqynpuv", Rawindex: "/tmp/z3QRNA2BGB", Output: "PhDThesis.not"
Building indexentry-tree:
Hierdepth of index is :TREE
sort-indexentries: (FORWARD BACKWARD FORWARD FORWARD)
sort-indexentries: (FORWARD BACKWARD FORWARD FORWARD)
sort-indexentries: (FORWARD BACKWARD FORWARD FORWARD)
sort-indexentries: (FORWARD BACKWARD FORWARD FORWARD)
sort-indexentries: (FORWARD BACKWARD FORWARD FORWARD)
sort-indexentries: (FORWARD BACKWARD FORWARD FORWARD)
sort-indexentries: (FORWARD BACKWARD FORWARD FORWARD)
ERROR: CHAR: index 0 should be less than the length of the string
*** Unable to execute: 'xindy -L english -I xindy -M "PhDThesis" -t "PhDThesis.nlg" -o "PhDThesis.not" "PhDThesis.ntn"' ***
Status report:
Opening logfile "PhDThesis.nlg" (done)
Reading indexstyle...
Loading module "/tmp/HCmyqynpuv"...
Loading module "lang/english/latin9-lang.xdy"...
Loading module "lang/english/latin9.xdy"...
Finished loading module "lang/english/latin9.xdy".
Finished loading module "lang/english/latin9-lang.xdy".
Loading module "PhDThesis.xdy"...
Loading module "tex.xdy"...
Finished loading module "tex.xdy".
Finished loading module "PhDThesis.xdy".
Finished loading module "/tmp/HCmyqynpuv".
Finished reading indexstyle.
Finalizing indexstyle... (done)
Reading raw-index "/tmp/z3QRNA2BGB"...
Finished reading raw-index.
Processing index...
ERROR: CHAR: index 0 should be less than the length of the string
Help please.
Best Answer
It sounds like xindy is unable to determine how to sort one or more of your entries, but without a minimal example it's hard to tell exactly. The default is for xindy to sort on the entry
name
unless you have specified asort
value. However, xindy ignores (La)TeX commands so if the sort key only contains commands, xindy is left with a blank sort key and issues a warning. Earlier versions of xindy gave a somewhat cryptic error:Newer versions give a slightly more understandable warning:
Since the first warning isn't very easy to understand,
makeglossaries
searches for instances of it and if found gives the warning:Here's a minimal example illustrating the problem:
In this case the first term has the sort key
\P
and the second term has the sort key\S
. In both cases, once xindy has stripped out the commands, it's left with an empty sort string and doesn't know how to compare the entries. Should\P
come before or after\S
? The solution is to provide a sort key for these entries:If all your terms are like this (for example they are all symbols) then it may not make any sense trying to sort them alphabetically. In which case it might be better to sort them by definition (package option
sort=def
, as you mentioned in your comment) or by use in the document. In either of these cases,glossaries
manufactures a numerical sort key for each term, so the issue no longer arises.Edit: There's a GUI diagnostic tool for the
glossaries
package calledmakeglossariesgui
which can provide further details by analysing the.aux
,.log
and associated glossary files. The example below has three problematic entries and a working one for comparison:A LaTeX run is first required to generate the
.aux
file (although this is usually already present if you're trying to work out whyxindy
has failed). The.aux
file can then be opened inmakeglossariesgui
using the File > Open menu item.For the above MWE, an error dialog is displayed to show that
xindy
failed:Once that dialog box is dismissed, the "Diagnostics" tab lists each problem:
The text displayed is:
So this explicitly identifies each problematic entry by its label (which neither
xindy
normakeglossaries
do).The "General Information" tab contains a "Details" link, which when clicked on opens a window with a summary of all the entries. The second column shows the sort key, which is displayed in red if there's a problem with it.
Once the problems have been fixed, you can switch back to using
makeglossaries
or explicitlyxindy
.Incidentally, the
glossaries-extra
package, provides the command\glsxtrnewsymbol
when thesymbols
package option is used. This internally uses\newglossaryentry
but sets thesort
value to the label rather than thename
field. For example:This is equivalent to