TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my document I use several glossaries, one of which is for the nomenclature. I have some special wishes for the sorting of this glossary. The easist way to achieve what I want is if I could give the sort=def option for only one glossary, but as fasr as I can tell this is only available as a package option.

Therefore I think I might have to write my own rules. Since I have no experience with xindy what soever I would like to know if the following rules are a good starting point.

What I want:

  1. a term X prefixed with # comes right after X
  2. if a term X is followed by an underline it comes right after X and before #X



What I think might be reasonable rules after looking here:

(merge-rule "<startOfLine>\#"(.*)<endOfLine>" "\1~e")
(merge-rule "<startOfLine>(.*[^~e])<endOfLine>" "\1~b")
(merge-rule "_" "~b")

I am not sure how to force a match for the entire line with the first rule. I am not sure either how to formulate the does not end with last character bit in the second rule. The second rule aims to prevent \#X ending up behind Xa.

Furthermore I looked at samplexdy.tex from the glosaries package (docfolder/samples) and noted that the according xindy file looked huge, so any pointers on where I insert my rules or what I actually need would be apreciated. And how do I teach glossaries that I want to use the modified xindy file only for one glossary out of several?

share|improve this question
up vote 5 down vote accepted

As from glossaries version 4.04, it's now possible to use different sort methods, but only if you use the \makenoidxglossaries option which uses TeX to perform the sorting:





% main glossary


% nomenclature

Test document.





(Two LaTeX runs are required to display the glossaries.) This produces:

Image of resulting glossaries

share|improve this answer
thank you very much for this new feature, while I already turned in the thesis for which I required this (and worked arround it by adding sort keys by hand), this will come in handy – ted Mar 20 '14 at 18:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.