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}
Best Answer
It seems that grouping does not work properly with tabular styles with glossary-creation 'Option 1'. If you use
\makeglossaries
with themakeglossaries
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:This was compiled with
The problem with using
\makenoidxglossaries
etc. is not that the group skip is ignored. It is thatglossaries
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:If
\makeglossaries
and\printglossaries
are used instead, the grouping is correct:Alternatively, if
\makenoidxglossaries
and\printnoidxglossaries
are used with the default (list) style andthen the grouping is also correct: