Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

Example

 X
#X
 X_index
#X_index
 Xindex
#Xindex

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

1 Answer 1

up vote 4 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:

\documentclass{article}

\usepackage[nopostdot,nogroupskip]{glossaries}

\newglossary{nomen}{}{}{Nomenclature}

\makenoidxglossaries

% main glossary

\newglossaryentry{goose}{name={goose},description={}}
\newglossaryentry{zebra}{name={zebra},description={}}
\newglossaryentry{duck}{name={duck},description={}}
\newglossaryentry{aardvark}{name={aardvark},description={}}

% nomenclature
\newglossaryentry{X}{type=nomen,name={X},description={}}
\newglossaryentry{hashX}{type=nomen,name={\#X},description={}}
\newglossaryentry{X-index}{type=nomen,name={X\_index},description={}}
\newglossaryentry{hashX-index}{type=nomen,name={\#X\_index},description={}}
\newglossaryentry{Xindex}{type=nomen,name={Xindex},description={}}
\newglossaryentry{hashXindex}{type=nomen,name={\#Xindex},description={}}

\begin{document}
Test document.

\glsaddall

\printnoidxglossary[sort=word]

\printnoidxglossary[type=nomen,sort=def]

\end{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 at 18:27

Your Answer

 
discard

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.