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.

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?

share|improve this question
    
I suspect the solution could be in \glsgetgrouptitle and/or \...groupname, but so far I've failed to find a workround. –  nnunes Feb 20 '13 at 20:39

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
I had tried to define the commands \ggroupname, and \sgroupname, but that didn't work. So in my ignorance I assumed \Ggroupname and \Sgroupname wouldn't work either. Can I please buy you a beer? :-) –  nnunes Feb 21 '13 at 3:13
    
@NunoNunes I read the source of glossary.sty. And YES! ;-) –  mafp Feb 21 '13 at 8:38
    
Gentlemen, I have a problem now. I redefined \Agroupname etc., but now my headings in the ACTUAL glossary are redefined as well. Thus, headings above terms starting with an A are now for example in a section called "Greek Letters"... Any idea how I can fix this? –  Ingo Oct 29 '13 at 11:54
    
@Ingo I'm afraid I can't follow. The question and the answer here deal with the case that you only have three groups, each with a single heading. You seem to want to have additional headings for alphanumeric sorting within these three main groups? Maybe you should ask a separate question for that. –  mafp Oct 29 '13 at 22:48
    
Here's the deal. I have a list of acronyms, a list of symbols, a list of indices, and an actual glossary (of the style: Term - Description). I use the keys a-g for section in my lists, e.g. aA for classifying it as a Latin letter A. This I do by redefining Agroupname etc. What would happen then, however, is that in the actual glossary at the end of the document, there would not be a heading A anymore, but for example Greek letters. However, by now I have managed to work around this by Just redefining the commands at the end again... –  Ingo Oct 30 '13 at 9:28

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.