Advertisement
obernardovieira

Glossary at page's end

Mar 6th, 2017
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 1.61 KB | None | 0 0
  1. % special thanks to Nicola Talbot
  2. % http://tex.stackexchange.com/a/292136
  3.  
  4. \documentclass{book}
  5.  
  6. \usepackage{everypage}
  7. \usepackage{glossaries-extra}
  8.  
  9. \AddEverypageHook{%
  10.  \gdef\entrylabellist{}%
  11. }
  12.  
  13. \GlsXtrEnableEntryUnitCounting{general}{0}{page}
  14.  
  15. \newcommand*{\entrylabellist}{}
  16.  
  17. \makeatletter
  18. \def\@glo@sortinghandler{\@glo@sorthandler@word}%
  19. \newcommand*{\sortpageentries}{%
  20.  \forglsentries{\thisentry}{%
  21.    \ifnum\glsentryprevcount{\thisentry}>0\relax
  22.     \expandafter\@glo@sortedinsert\expandafter\entrylabellist\expandafter
  23.       {\thisentry}%
  24.    \fi
  25.  }%
  26. }
  27.  
  28. \newcommand*{\glsxtrpostlinkgeneral}{%
  29.  \ifnum\glsentrycurrcount{\glslabel}=1\relax
  30.    \footnotemark[1]%
  31.    \ifdefempty\entrylabellist
  32.    {%
  33.      \sortpageentries
  34.      \footnotetext[1]{\@for\thisentry:=\entrylabellist\do{%
  35.       \glsentryname{\thisentry} \glsentrydesc{\thisentry}. }}%
  36.    }%
  37.    {}%
  38.  \fi
  39. }
  40. \makeatother
  41.  
  42. \newglossaryentry{uno}{name=uno,description=one}
  43. \newglossaryentry{dos}{name=dos,description=two}
  44. \newglossaryentry{tres}{name=tres,description=three}
  45. \newglossaryentry{quatro}{name=quatro,description=four}
  46. \newglossaryentry{cinco}{name=cinco,description=five}
  47.  
  48.  
  49. \begin{document}
  50.  
  51. Counting to three in Spanish, \gls{uno}, \gls{dos},
  52. \gls{tres}.  Counting to five in Spanish, \gls{uno},
  53. \gls{dos}, \gls{tres}, \gls{quatro}, \gls{cinco}.
  54.  
  55. Notice how \gls{uno}, \gls{dos}, and \gls{tres} only appear once in
  56. the footnotes despite being glossed three times.
  57.  
  58. \newpage
  59.  
  60. Test next page.
  61.  
  62. \gls{tres}, \gls{quatro} and \gls{cinco}.
  63. And again:
  64. \gls{tres}, \gls{quatro} and \gls{cinco}.
  65.  
  66. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement