glossaries package FAQ

What does the xindy error “CHAR: index 0 should be less than the length of the string” mean? 🔗

xindy discards all commands and braces from the sort string. If your sort string (either specified explicitly by the sort key or implicitly by the name key) only consists of commands, this will be treated by xindy as an empty sort string, which produces an error message in newer versions of xindy. For example, the following will cause a problem:

\newglossaryentry{alpha}{name={\ensuremath{\alpha}},  
  description={...}} 
Either use a different sort key for the entry, for example:
\newglossaryentry{alpha}{sort=alpha,  
  name={\ensuremath{\alpha}},  
  description={...}} 
or, if all entries are like this, you may prefer to use the sort=use or sort=def package options. See the Sorting Options section of the user manual for further details of the sort option.

If you are using glossaries-extra, the symbols package option will provide the command \glsxtrnewsymbol[options]{label}{symbol}. The definition is simply:

\newglossaryentry{label}{name={symbol},
 sort={label},type=symbols,category=symbol,options}

This assigns the sort key to the label (unless explicitly overridden in options). This will avoid the problem (although you need to consider whether or not the label is an appropriate sort value). There is a similar command associated with the numbers package option.

You might also want to consider switching to bib2gls, which has a limited understanding of some LaTeX commands. For example, if the entry is defined as:

@entry{alpha,
  name={\ensuremath{\alpha}},
  description={...}
}

Then the default sort value will be 𝛼 (mathematical alpha, Unicode value U+1D6FC). Alternatively, if the entry is defined as:

@symbol{alpha,
  name={\ensuremath{\alpha}},
  description={...}
}

Then the sort value will default to the label (analogous to \glsxtrnewsymbol). See also Gallery (bib2gls): sorting.

2020-07-01 12:23:02


Permalink: https://www.dickimaw-books.com/faq.php?id=181
Alternative link: https://www.dickimaw-books.com/faq.php?itemlabel=charindex0

Category: glossaries package
Topic: Indexing Application Errors