# Custom glossary style, \makenoidxglossaries and \glsgroupskip

The code below creates a glossary table containing acronyms, their representation in math expressions and their description. A custom glossary style my is created using \newglossarystyle. It is a table with a \tabularnewline between every entry group, as set by redefining \glsgroupskip. However, the code produces a new line between every entry, not just the groups. By default, groups are based on the first letter of an entry, e.g. ‘bar’ and ‘baz’ should be in a group and ‘foo’ and ‘qux’ are separately grouped.

The default style (i.e. disable the line \setglossarystyle{my}) does create groups with extra separation between them. Why/where does my style fail?

Note that I use ‘Option 1’ as defined in the glossaries package manual, i.e. \makenoidxglossaries.

\documentclass{article}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage{tabu}
\usepackage[shortcuts]{glossaries}
\makenoidxglossaries

\glsaddkey{math}{}{\acem}{\Acem}{\acm}{\Acm}{\ACm}

\newacronym[math=\mathfrak{foo}]{foo}{foo}{Foo}
\newacronym[math=\mathfrak{bar}]{bar}{bar}{Bar}
\newacronym[math=\mathfrak{baz}]{baz}{baz}{Baz}
\newacronym[math=\mathfrak{qux}]{qux}{qux}{Qux}

\newglossarystyle{my}{%
% redefine theglossary environment
\renewenvironment{theglossary}%
% begin
{\begin{longtabu} spread 0pt {@{}X[1Lm]X[1Lm]X[3Jm]@{}}}%
% end
{\bottomrule
\end{longtabu}}%
\renewcommand*{\glossaryheader}{%
\toprule%
Abbreviation & Symbol in Mathematical Expressions & Description \\ \midrule%
}%
\renewcommand*{\glsgroupskip}{%
\tabularnewline%
}%
\renewcommand*{\glossentry}[2]{%
\glstarget{##1}{\glossentryname{##1}}%
&%
$\acem{##1}$%
&%
\glossentrydesc{##1}%
\\%
}%
}

\setglossarystyle{my}

\begin{document}
\glsaddallunused
\printnoidxglossaries
\end{document}

• Not exactly on topic, but I wouldn't use tabu.
– cfr
Apr 3 '15 at 18:47
• @cfr - Please elaborate on that statement. I use it because I like it better than tabularx and tabulary. What does it do that has adverse effects?
– Erik
Apr 3 '15 at 18:51
• The author has promised to release an update which will not be backwards compatible. This means that your stuff is likely to break badly at some point, possibly at just the wrong moment. I'll see if I can find the link in a minute. The author also won't fix serious bugs in the current version.
– cfr
Apr 3 '15 at 19:59
• See here and this discussion. Here's one bug in the version you have which the author doesn't care about because his/her version works OK. Of course, when you finally get the author's version, all your current code will break, and tabu as you know it will no longer be available.
– cfr
Apr 3 '15 at 20:17
• Thanks for pointing that out. I'll be cautious with the package in the future. The most recent post by the author in the Google+ thread mentions that this summer is aimed at for the release of the reworked package. Even though there will be no backwards compatibility, I believe the functionality will be the same (and enhanced). I do not have too many active documents with tables, therefore it won't be a problem to rewrite a few tabus when that time comes.
– Erik
Apr 4 '15 at 5:18

## 1 Answer

It seems that grouping does not work properly with tabular styles with glossary-creation 'Option 1'. If you use \makeglossaries with the makeglossaries script, it works fine. Or, if you use a list style, it works fine. I am not sure if this is a bug or a recognised limitation.

Here is an example with the makeglossaries script:

\documentclass{article}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage[shortcuts]{glossaries}
\makeglossaries

\glsaddkey{math}{}{\acem}{\Acem}{\acm}{\Acm}{\ACm}

\newacronym[math=\mathfrak{foo}]{foo}{foo}{Foo}
\newacronym[math=\mathfrak{bar}]{bar}{bar}{Bar}
\newacronym[math=\mathfrak{baz}]{baz}{baz}{Baz}
\newacronym[math=\mathfrak{qux}]{qux}{qux}{Qux}

\newglossarystyle{my}{%
\setglossarystyle{long3colheader}%
\renewcommand*{\glossaryheader}{%
\toprule
Abbreviation & Symbol in Mathematical Expressions & Description \tabularnewline\midrule\endhead
\bottomrule\endfoot
}%
\renewcommand*{\glsgroupskip}{%
& &\tabularnewline}%
\setlength\glsdescwidth{.275\textwidth}%
\setlength\glspagelistwidth{.45\textwidth}%
\renewcommand{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & $\acem{##1}$ & \glossentrydesc{##1}\tabularnewline
}%
}

\setglossarystyle{my}

\begin{document}
\glsaddallunused
\printglossaries
\end{document}


This was compiled with

pdflatex <filename>
makeglossaries <filename>
pdflatex <filename>


The problem with using \makenoidxglossaries etc. is not that the group skip is ignored. It is that glossaries erroneously believes that every entry starts a new group.

Here's an example using a standard style which demonstrates that it is not your particular definition of my which causes the problem:

\documentclass{article}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage[shortcuts]{glossaries}
\makenoidxglossaries

\glsaddkey{math}{}{\acem}{\Acem}{\acm}{\Acm}{\ACm}

\newacronym[math=\mathfrak{foo}]{foo}{foo}{Foo}
\newacronym[math=\mathfrak{bar}]{bar}{bar}{Bar}
\newacronym[math=\mathfrak{baz}]{baz}{baz}{Baz}
\newacronym[math=\mathfrak{qux}]{qux}{qux}{Qux}

\setglossarystyle{long3colheader}
\renewcommand*\glsgroupskip{%
X & X & X\tabularnewline}

\begin{document}
\glsaddallunused
\printnoidxglossaries
\end{document}


If \makeglossaries and \printglossaries are used instead, the grouping is correct:

Alternatively, if \makenoidxglossaries and \printnoidxglossaries are used with the default (list) style and

\renewcommand*\glsgroupskip{%
\item XXX}


then the grouping is also correct:

• Unless someone else proves you're wrong (on the undocumented limitation of \makenoidxglossaries), I believe this would be the best answer to this question. I just wonder why it can recognise groups in a list, which proves it can do its job.
– Erik
Apr 3 '15 at 20:14
• @Erik They may well prove me wrong. This is just the result of uninformed experimentation;). But I thought it useful as a starting point, at least. In particular, the fact that you get the wrong result with a standard style shows that staring at your particular definition of my is unlikely to get at the issue....
– cfr
Apr 3 '15 at 20:20