LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and AcronymsHow to keep the group heading in glossaries with the first entry in the group?

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
eezacque
Posts: 7
Joined: Mon Jan 06, 2020 5:47 pm

How to keep the group heading in glossaries with the first entry in the group?

Postby eezacque » Sat Feb 01, 2020 12:22 pm

In a document with glossaries set in multicols, it often happens that the heading of a group, say 'A', ends up on the bottom of a column, while the first member of the group, say 'Albert', sits at the top of the next column. Is there any remedy?

An example:
Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass{article}
  2.  
  3. \usepackage[a4paper, textheight=5in]{geometry}
  4. \usepackage{multicol}
  5. \usepackage[automake,xindy]{glossaries}
  6.  
  7. \newglossary[wrg]{glos}{wrd}{wrn}{Glossary}
  8.  
  9. \newglossaryentry{A}{name=A,description=A}
  10. \newglossaryentry{B}{name=B,description=B}
  11. \newglossaryentry{C}{name=C,description=C}
  12. \newglossaryentry{D}{name=D,description=D}
  13. \newglossaryentry{E}{name=E,description=E}
  14. \newglossaryentry{F}{name=F,description=F}
  15. \newglossaryentry{G}{name=G,description=G}
  16. \newglossaryentry{H}{name=H,description=H}
  17. \newglossaryentry{I}{name=I,description=I}
  18. \newglossaryentry{J}{name=J,description=J}
  19. \newglossaryentry{K}{name=K,description=K}
  20. \newglossaryentry{L}{name=L,description=L}
  21. \newglossaryentry{M}{name=M,description=M}
  22. \newglossaryentry{N}{name=N,description=N}
  23. \newglossaryentry{O}{name=O,description=O}
  24. \newglossaryentry{P}{name=P,description=P}
  25. \newglossaryentry{Q}{name=Q,description=Q}
  26. \newglossaryentry{R}{name=R,description=R}
  27. \newglossaryentry{S}{name=S,description=S}
  28. \newglossaryentry{T}{name=T,description=T}
  29. \newglossaryentry{U}{name=U,description=U}
  30. \newglossaryentry{V}{name=V,description=V}
  31. \newglossaryentry{W}{name=W,description=W}
  32. \newglossaryentry{X}{name=X,description=X}
  33. \newglossaryentry{Y}{name=Y,description=Y}
  34. \newglossaryentry{Z}{name=Z,description=Z}
  35.  
  36.  
  37.  
  38. \makeglossaries
  39.  
  40. \begin{document}
  41.  
  42. \glsaddall
  43.  
  44.  
  45. \begin{multicols}{2}
  46.  
  47. \printglossary[style=indexgroup]
  48.  
  49. \end{multicols}
  50.  
  51. \end{document}

eezacque
Posts: 7
Joined: Mon Jan 06, 2020 5:47 pm

Postby eezacque » Thu Feb 06, 2020 10:43 pm

Ulrike Fischer sorted this out at usenet group comp.text.tex:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \makeatletter \newcommand\indexheaderspace{\par\nopagebreak\vskip 10\p@
  2. \@plus 5\p@ \@minus 3\p@ \relax\@afterheading}
  3. \makeatother \renewglossarystyle{indexgroup}{%
  4. \setglossarystyle{index}%
  5. \renewcommand*{\glsgroupheading}[1]{%
  6. \item \glstreegroupheaderfmt{\glsgetgrouptitle{##1}}%
  7. \indexheaderspace
  8. }%
  9. }


Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 2 guests