[Tex/LaTex] Customising glossary group titles

glossariesnamingsubdividing

I'm using the glossaries package to produce multiple glossaries in the same document and have found it convenient to define my own glossary style.

When makeindex is used the glossary is sub-divided into a maximum of 28 logical blocks that are determined by the first character of the sort key set with \newglossaryentry. The sub-divisions are, respectively: symbols, numbers, and A,…,Z. I need to have three separate glossary groups, and for that I prepend the sort key of glossary entries with the following letters:

  • a for a group of numbers and letters
  • g for a group of Greek letters
  • s for a group of subscripts

Here's a MWE (just run (pdf)latex twice on it with --shell-escape):

\documentclass{article}
\usepackage[nomain,makeindex]{glossaries}

%% new glossary style
\newglossarystyle{onecol}{%
%
\renewenvironment{theglossary}%
{\begin{description}}{\end{description}}%
%
\renewcommand*{\glossaryheader}{}%
%
% indicate what to do at the start of each logical group
\renewcommand*{\glsgroupheading}[1]{%
\item[{\glsgetgrouptitle{##1}}]}
%
\renewcommand*{\glsgroupskip}{\indexspace}%
%
\renewcommand*{\glossaryentryfield}[5]{%
\item[\glstarget{##1}{##2}] ##3%
}%
}

%% glossary
\newglossary{model}{model.sys}{model.syo}{Nomenclature}

%% glossary entries
\newglossaryentry{L}{sort={aL},name={\ensuremath{\mathcal{L}}},type={model},
                       description={lift function}}
\newglossaryentry{CL}{sort={aCL},name={\ensuremath{C_L}},type={model},
                        description={lift coefficient}}
%
\newglossaryentry{alpha}{sort={galpha},name={\ensuremath{\alpha}},type={model},
                           description={angle of attack}}
\newglossaryentry{beta}{sort={gbeta},name={\ensuremath{\beta}},type={model},
                          description={sideslip angle}}
%
\newglossaryentry{fs}{sort={sfs},name={\ensuremath{\infty}},type={model},
                        description={free-stream condition}}

\immediate\write18{makeglossaries \jobname}
\makeglossaries

\begin{document}
\glsaddall
\printglossary[type={model},style={onecol}]
\end{document}

enter image description here

The way theglossary environment is redefined above is somewhat redundant, but I only wish to provide a working example for now.

Question

Is it possible to remove the title of the first group, and change the titles of the second and third groups to Greek letters, and Subscripts, respectively?

If yes, do I need to call xindy using my own style file or does a change in the way I define the glossary style onecol suffice?

Best Answer

You are on the right track, but we can use the existing \glsgetgrouptitle. Note, however, that with this solution all your glossary entries should have an a, g, or s prefix in the sort key. Put

\newcommand*{\Agroupname}{}
\newcommand*{\Ggroupname}{Greek letters}
\newcommand*{\Sgroupname}{Subscripts}

into your preamble to obtain special nomenclature

If desired, you may also redefine \glsgroupheading inside the \newglossarystyle declaration as follows (requires the etoolbox package):

\renewcommand*{\glsgroupheading}[1]{%
\ifstrequal{A}{##1}{\relax}%
{\item[{\glsgetgrouptitle{##1}}]}%
}
%
\newcommand*{\Ggroupname}{Greek letters}
\newcommand*{\Sgroupname}{Subscripts}

This way \glsgroupheading does nothing at the start of the first glossary group:

enter image description here

Related Question