# How to suppress glsgroupskip on pagebreak? (glossaries package)

I'm using the 'glossaries' package to build a list of abbreviations. I have my own style defined based on a standard longtable style (to easily see what's the matter I pick the 'longheaderborder' style). The problem occurs when the list of abbreviations spreads over a single page and you have a style where the value 'glsgoupskip' is greater than zero. In the used style this means, that the entries within the list are grouped based on the first letter and between each group there is a blank line in the longtable.

If this groupskip coincide with a pagebreak (longtable pagebreak), naturally you get a blank line at the end of the first page or at the beginning at the second page. To clarify what is going on here's my Minimal Example:

\documentclass[]{scrbook}

\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
% glossaries
\usepackage[%
acronym % use acronym functionality
,section = section % use sections for all glossary lists
]{glossaries}
% some acronyms
\newacronym{mimo}{MIMO}{Multiple Input Multiple Output}
\newacronym{miso}{MISO}{Multiple Input Single Output}
\newacronym{simo}{SIMO}{Single Input Multiple Output}
\newacronym{siso}{SISO}{Single Input Single Output}
\newacronym{cdma}{CDMA}{Code Division Multiple Access}
\newacronym{ofdm}{OFDM}{Orthogonal Frequency Division Multiplex}

% switch on glossaries
\makeglossaries

\begin{document}
\chapter{Notation}
\vspace{28\baselineskip}
% print list of acronyms
\end{document}


I've added the vspace to prevent me from typing too much abbreviations. :)

To cut a long story short: How can one suppress the glsgroupskip if a pagebreak has occurred?

edit:

To compile this document I do the following calls:

1. pdflatex %
2. makeindex -s %.ist -t %.alg -o %.acr %.acn
3. pdflatex %

where % indicates the document file name.
When I run my example from above there is a groupskip (ie blank line) directly after the MISO entry. Right beneath this groupskip the pagebreak occurs so there is a blank line left at the bottom of the table on the first page.

If you set the vertical skip to 29\baselineskip this blank line will occur at the top of the table on the second page right beneath the table head.

For the sake of completeness here's a MWE with my own defined style using 'tabu' and 'booktabs' package. To build this document I call the same commands as mentioned above. The aim is to set groupskip to \addlinespace (booktabs command) but the problem is more clearly with a full blank line ( &\\ ).

\documentclass[]{scrbook}

\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}

% table packages
\usepackage{booktabs,longtable,tabu}
% glossaries
\usepackage[%
acronym % use acronym functionality
,section = section % use sections for all glossary lists
,nonumberlist % no page references in lists
,nostyles % do not load  any style
]{glossaries}

% define new style for acronyms
\newglossarystyle{my_acronymlist}{%
\renewenvironment{theglossary}%
{\begin{longtabu} to\linewidth {lX}}%
{\end{longtabu}}%
\bottomrule\endfoot}%
\renewcommand*{\glossaryentryfield}[5]{%
\glstarget{##1}{##2} & \glsentrydesc{##1}\\}%
%
\renewcommand*{\glossarysubentryfield}[6]{%
&%
\glssubentryitem{##2}%
\glstarget{##2}{\strut}##4 & ##6\\}%
%
%*** GROUP SKIP ***
\renewcommand*{\glsgroupskip}{&\\}%
%******************
}

% some acronyms
\newacronym{mimo}{MIMO}{Multiple Input Multiple Output}
\newacronym{miso}{MISO}{Multiple Input Single Output}
\newacronym{simo}{SIMO}{Single Input Multiple Output}
\newacronym{siso}{SISO}{Single Input Single Output}
\newacronym{cdma}{CDMA}{Code Division Multiple Access}
\newacronym{ofdm}{OFDM}{Orthogonal Frequency Division Multiplex}

% switch on glossaries
\makeglossaries

\begin{document}

\chapter{Notation}

\vspace{28\baselineskip}
% print list of acronyms
\printglossary[type=\acronymtype,style=my_acronymlist]

\end{document}


With this style I get this blank groupskip-line at the top of the second page.

\expandafter\let\csname @glsstyle@my_acronymlist\endcsname\relax


right before the style definition, and set

\renewcommand*{\glsgroupskip}{\noalign{\penalty-50\vskip\normalbaselineskip}}%


sadly I can't see any change.
Nevertheless, thanks so far for your help. Hopefully there will be a solution...

-

Probably you should use a real space rather than a blank table row so it is automatically discarded. This would look better if there were no vertical rules but I've left those in for now.

adding this to the preamble after the glossaries package is loaded probably does something.

\expandafter\let\csname @glsstyle@long\endcsname\relax
\newglossarystyle{long}{%
\renewenvironment{theglossary}%
{\begin{longtable}{lp{\glsdescwidth}}}%
{\end{longtable}}%
\renewcommand*{\glossaryentryfield}[5]{%
\glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5\\}%
\renewcommand*{\glossarysubentryfield}[6]{%
&
\glssubentryitem{##2}%
\glstarget{##2}{\strut}##4\glspostdescription\space ##6\\}%
\renewcommand*{\glsgroupskip}{\noalign{\penalty-50\vskip\normalbaselineskip}}%
}


The above probably ought to have worked in an ideal world, but longtable has a few "features" that defeat this. Notably that the table head is not inserted by the output routine for the current page but rather it is injected by the output routine for the previous page. This means that the glue is not discarded at the top of the page. (Normally this is not an issue as tables do not have discardable glue....

So, the following appears to work. The penalty -50 and the skip added between groups (15pt here) are fairly arbitrary but the penalty probably should be negative and the values must be the same where they are set in the \noalign in your acronym style and (twice) where a correction is inserted into longtable internals

The redefinition of \LT@output gets LT to check if the page break happened at -50 and if so backs up by 15pt to allow for the 15pt skip added at these special breaks.

\documentclass[]{scrbook}

\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}

% table packages
\usepackage{booktabs,longtable,tabu}
% glossaries
\usepackage[%
acronym % use acronym functionality
,section = section % use sections for all glossary lists
,nonumberlist % no page references in lists
,nostyles % do not load  any style
]{glossaries}

% define new style for acronyms
\newglossarystyle{my_acronymlist}{%
\renewenvironment{theglossary}%
{\begin{longtabu} to\linewidth {lX}}%
{\end{longtabu}}%
\bottomrule\endfoot}%
\renewcommand*{\glossaryentryfield}[5]{%
\glstarget{##1}{##2} & \glsentrydesc{##1}\\}%
%
\renewcommand*{\glossarysubentryfield}[6]{%
&%
\glssubentryitem{##2}%
\glstarget{##2}{\strut}##4 & ##6\\}%
%
%*** GROUP SKIP ***
\renewcommand*{\glsgroupskip}{&\\}%
\renewcommand*{\glsgroupskip}{\noalign{\penalty-50\vskip15pt\relax}}%

%******************
}

% some acronyms
\newacronym{mimo}{MIMO}{Multiple Input Multiple Output}
\newacronym{miso}{MISO}{Multiple Input Single Output}
\newacronym{simo}{SIMO}{Single Input Multiple Output}
\newacronym{siso}{SISO}{Single Input Single Output}
\newacronym{cdma}{CDMA}{Code Division Multiple Access}
\newacronym{ofdm}{OFDM}{Orthogonal Frequency Division Multiplex}

% switch on glossaries
\makeglossaries

\makeatletter
\def\LT@output{%
\ifnum\outputpenalty <-\@Mi
\ifnum\outputpenalty > -\LT@end@pen
\LT@err{floats and marginpars not allowed in a longtable}\@ehc
\else
\setbox\z@\vbox{\unvbox\@cclv}%
\ifdim \ht\LT@lastfoot>\ht\LT@foot
\dimen@\pagegoal
\ifdim\dimen@<\ht\z@
\setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot\vss}%
\@makecol
\@outputpage
\ifnum\outputpenalty=-50\vskip-15pt\relax\fi
}%
\fi
\fi
\global\@colroom\@colht
\global\vsize\@colht
%      \vbox
{\unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi}%
\fi
\else
\setbox\@cclv\vbox{\unvbox\@cclv\copy\LT@foot\vss}%
\@makecol
\@outputpage
\global\vsize\@colroom
\ifnum\outputpenalty=-50\vskip-15pt\relax\fi
\nobreak
\fi}
\makeatother
\begin{document}

\chapter{Notation}

\vspace{28\baselineskip}
% print list of acronyms