3

I've used makeindex and the glossaries package to create a glossary, but I'd like to change the sort order for one of the "letter groups".

Basically, I have a set of entries that begin with a letter that isn't included in the default letter groups [A-Z]. All entries that begin with this letter are currently sorted under the "symbols" group. It was easy to change the name of the "symbols" group label to display the missing letter, but I would like this letter to be sorted after the "m" letter group rather than before the "a" letter group.

Is there an easy way to change the sort order for letter groups? I've been reading through the documentation, but I haven't found anything so far. Any help would be appreciated.

  • Welcome! I think you need xindy. If I remember correctly. – cfr Jul 9 '15 at 21:27
  • Yeah, I've seen a lot of people talk about using xindy and if I had more time I would look into that solution. Unfortunately, I have several complex glossaries and I'm on a very tight deadline. I either need to find a quick way to adjust the sort order with makeindex or I'll just have to use a glossary style that doesn't display the letter groups and adjust what's listed in the sort id to get these 10 words listed before the /n/ entries. Since I don't need to "add" a letter group, I'm hoping there's a simple way to just change the sort order for a letter group. – user1201 Jul 9 '15 at 21:36
  • what about \index{mzzzmyword@myword} – touhami Jul 9 '15 at 21:44
  • Right. I know that would place these ten entries before the n-entries. But I don't think that gives me a letter in the hyperlinked navigation bar at the beginning of the glossary... If I can, I'd like to have these ten entries be sorted before the n-entries and also have a letter appear in the navigation bar that would link to the beginning of this group of entries. – user1201 Jul 9 '15 at 21:53
  • The way I currently have it, these entries are sorted under the "symbols" letter group and the "symbols" header label has been changed to print the first letter of these entries rather than "symbols". Now, if it's possible, I'm just trying to find a way to have the "symbols" group ( both the header label in the navigation bar and the entries) be sorted after the M group. – user1201 Jul 9 '15 at 21:55
2

Here is a solution (trick, one can do better)

enter image description here

We define new entry (M-N, for example)

\newglossaryentry{mn}{%
name={\\[.5ex]\glsnavhypertarget{M-N}{M-N}\\[.5ex]}, 
description={\nopostdesc},sort=mzz}

here we should adjust vertical spaceing to look like group's heading. and sort=mzz to be after M group

Now specific entries are defined as sub-entries of (M-N)

\newglossaryentry{bal}{%
name={\hspace{-1em}$\beta$}, text={$\beta$},
description={algebra2},sort=mzzb, parent=mn} 

horizontal space adjusted by hspace{-1em}

MWE

\documentclass{article}
\usepackage{hyperref}

\usepackage[style=treehypergroup]{glossaries}

\makeglossaries

\newglossaryentry{mn}{%
name={\\[.5ex]\glsnavhypertarget{M-N}{M-N}\\[.5ex]}, 
description={\nopostdesc},sort=mzz}

\newglossaryentry{bla}{%
name=math,
description={algebra1}}

\newglossaryentry{bal}{%
name={\hspace{-1em}$\beta$}, text={$\beta$},
description={algebra2},sort=mzzb, parent=mn}

\newglossaryentry{bbla}{%
name={\hspace{-1em}$\alpha$},text={$\alpha$},
description={algebra3},sort=mzza, parent=mn}

\newglossaryentry{foo}{%
name=theory,
description={algebra4}}

\newglossaryentry{bar}{%
name=sciences,
description={algebra5}}


\newglossaryentry{lipsum}{%
name={\hspace{-1em}$\gamma$}, text={$\gamma$},
description={algebra6},sort=mzzg, parent=mn}

\newglossaryentry{tex}{%
name=TeX,
description={algebra7}}


\begin{document}

bla bla bla bla \gls{tex}
bla bla bla bla \gls{bar}
bla bla bla bla \gls{foo}
bla bla bla bla \gls{lipsum}
bla bla bla bla \gls{bla}
bla bla bla bla \gls{bbla}
bla bla bla bla \gls{bal}


\printglossaries 
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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