 % This is a minimal file for testing and debugging
 % the glossaries package. Change the class file as
 % desired, and add the relevant package options to
 % both the class file and the glossaries package.
 % Change the sample glossary entry and acronym if
 % required. If the problem occurs with an additional
 % glossary, add in the relevant \newglossary command
 % and a sample entry.
 %
 % Only add extra packages or commands if they
 % contribute to whatever problem you are trying to
 % test.
 %
 % Remember that the document will not be complete
 % until you have successfully completed all of the
 % following steps:
 % 1. latex minimalgls
 % 2. makeglossaries minimalgls (note no extension)
 % 3. latex minimalgls
 % A further run through LaTeX will be required to ensure that
 % the table of contents is up to date if the toc option
 % is used.
\documentclass{article}
\listfiles
\usepackage[T1]{fontenc}
\usepackage[xindy]{glossaries}

\makeglossaries

\newglossaryentry{bread}{name={bread},description={A popular kind of food}}
\newglossaryentry{danishbread}{name={danish bread},description={\nopostdesc},see={brod}}
\newglossaryentry{brod}{name={br\o d},sort={brod},description={Bread like one eats it in Denmark}}


\begin{document}
People eat \gls{bread}. Danish peaple are like ordinary people, so they eat danish bread.
Danish bread is also called \gls{brod}.

\vspace{8cm plus 1cm minus 1cm}

We need some glue on this page. It's rather stretchable glue, to demonstrate what is going wrong. The
goal is to fill the page to the end, where we will quote a letter.

\vspace{7cm plus 1cm minus 1cm}

We have come close to the bottom of the page now, so it's time to quote the letter.

\vspace{2cm plus 1cm minus 0.8cm}

\noindent Dear Mr\@. Baker,\par
\nobreak%
\vspace{1cm plus 0.4cm minus 0.3cm}%
%Remove both \glsadd commands and a page break here will be properly prevented
%What also works is putting \indent or \noindent in front of \glsadd to move it into the horizontal
%material of the paragraph, instead of in the vertical material just before it.
\glsadd[format=(]{bread}%
The bread delivered today was again old and moldy. This has happened on previous occasions zeven times
in the past month. Therefore I wish to terminate my contract for daily deliveries of bread. I hope to
have you informed adequately in this letter.\glsadd[format=)]{bread}

\nobreak\vspace{1cm plus 0.4cm minus 0.3cm}
\noindent Sincerely, Mr\@. Smith\\
4 Adelaide Road\\
Bletchley\\
XY1-234

\vspace{2cm plus 1cm minus 0.8cm}
That was an angry letter about bread.
\printglossaries
\end{document}
