Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sorting entries in glossaries

1,355 views
Skip to first unread message

Mathias Lindner

unread,
Apr 30, 2009, 5:28:37 AM4/30/09
to
Hi

I have a question about how the entries in the glossary are sorted. Look
at the minimal example down there.
The package arranges all the capital symbols at first and afterwards all
the rest. But I want the 'n' to be set between 'M' and 'P', just as the
alphabet is.
Why is glossaries behaving like this and how can I change it?

\documentclass{scrreprt}
\usepackage[style=long]{glossaries}
\newglossary[slg]{symbole}{syi}{syg}{Symbolverzeichnis}
\makeglossaries
\newglossaryentry{M}{name={\ensuremath{M}}, description={Drehmoment},
type=symbole}
\newglossaryentry{P}{name={\ensuremath{P}}, description={Leistung},
type=symbole}
\newglossaryentry{n}{name={\ensuremath{n}}, description={Drehzahl},
type=symbole}
\begin{document}
\printglossary[type=symbole]
\gls{M}\gls{n}\gls{P}
\end{document}

Cheers,
Mathias

Nicola Talbot

unread,
Apr 30, 2009, 6:16:37 AM4/30/09
to
Mathias Lindner wrote:
> Hi
>
> I have a question about how the entries in the glossary are sorted. Look
> at the minimal example down there.
> The package arranges all the capital symbols at first and afterwards all
> the rest. But I want the 'n' to be set between 'M' and 'P', just as the
> alphabet is.
> Why is glossaries behaving like this and how can I change it?
>

You need to use the sort key if the name contains commands:

\documentclass{scrreprt}
\usepackage[style=long]{glossaries}
\newglossary[slg]{symbole}{syi}{syg}{Symbolverzeichnis}
\makeglossaries

\newglossaryentry{M}{name={\ensuremath{M}},sort=M,
description={Drehmoment}, type=symbole}
\newglossaryentry{P}{name={\ensuremath{P}},sort=P,
description={Leistung}, type=symbole}
\newglossaryentry{n}{name={\ensuremath{n}},sort=n,

description={Drehzahl}, type=symbole}
\begin{document}
\printglossary[type=symbole]
\gls{M}\gls{n}\gls{P}
\end{document}

Regards
Nicola Talbot
--
Home: http://theoval.cmp.uea.ac.uk/~nlct/
LaTeX Related Information: http://theoval.cmp.uea.ac.uk/~nlct/latex/
Creating a LaTeX Minimal Example:
http://theoval.cmp.uea.ac.uk/~nlct/latex/minexample/

Mathias Lindner

unread,
Apr 30, 2009, 7:48:26 AM4/30/09
to
Nicola Talbot schrieb:

Aha, ok. I thought it's looking at the ASCII codes of the symbols that
should be printed and therefore sorting the capitals before the rest.
Then I will have to add this key to all entries.

Thank you very much!
Mathias

Mathias Lindner

unread,
May 4, 2009, 9:07:20 AM5/4/09
to
Nicola Talbot schrieb:

Ok, I've done this and it is basically working. But I am still missing
some details. Now I have a sort group for each letter A to X. I also
have some Greek letters with name={\ensuremath{\omega}} for example.
Omitting the sort key there will put them in an additional symbol group.
Good as well.

But now two questions:
1. The symbols are sorted before the letters: Firstly the Greek letters,
then A to Z. But I want them afterwards: A to Z and then the Greek
letters. Is this possible?

2. I have some entries defining indices of symbols. Those are all
assigned to a parent entry called "\textbf{Indices}" so that they are
displayed together and a little bit separated from the rest of symbols.
The sort key of the parent indices was set to "zzzz" to achieve that
they are placed behind all other symbols. But now I need a new symbol
called "z", which will be placed in the same sort group than the whole
indices list. Is there a way to tell glossaries to put an entry
("indices in this case") at the back of the list?

Cheers,
Mathias

Nicola Talbot

unread,
May 5, 2009, 5:48:36 AM5/5/09
to
Mathias Lindner wrote:
> Ok, I've done this and it is basically working. But I am still missing
> some details. Now I have a sort group for each letter A to X. I also
> have some Greek letters with name={\ensuremath{\omega}} for example.
> Omitting the sort key there will put them in an additional symbol group.
> Good as well.
>
> But now two questions:
> 1. The symbols are sorted before the letters: Firstly the Greek letters,
> then A to Z. But I want them afterwards: A to Z and then the Greek
> letters. Is this possible?
>
> 2. I have some entries defining indices of symbols. Those are all
> assigned to a parent entry called "\textbf{Indices}" so that they are
> displayed together and a little bit separated from the rest of symbols.
> The sort key of the parent indices was set to "zzzz" to achieve that
> they are placed behind all other symbols. But now I need a new symbol
> called "z", which will be placed in the same sort group than the whole
> indices list. Is there a way to tell glossaries to put an entry
> ("indices in this case") at the back of the list?

It's the indexing application that actually deals with the sorting.
Makeindex is fairly inflexible, but you might have more luck with xindy.
You'd need to write your own xindy module that sets up the sorting rules
and letter groups. The glossaries package comes with a sample file
samplexdy.tex with a customised xindy module called samplexdy-mc.xdy
which sets up a separate Mc letter group which may help you get started.
You need to uncomment the following lines in samplexdy.tex to use
samplexdy-mc:

%\setStyleFile{samplexdy-mc} % note no extension
%\noist
%\GlsSetXdyLanguage{}

You might be able to get more help from the xindy mailing list
http://www.xindy.org/mailing-list.html

0 new messages