summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/robustindex/robustglossary.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/robustindex/robustglossary.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/robustindex/robustglossary.sty')
-rw-r--r--macros/latex/contrib/robustindex/robustglossary.sty65
1 files changed, 65 insertions, 0 deletions
diff --git a/macros/latex/contrib/robustindex/robustglossary.sty b/macros/latex/contrib/robustindex/robustglossary.sty
new file mode 100644
index 0000000000..f09ed55b37
--- /dev/null
+++ b/macros/latex/contrib/robustindex/robustglossary.sty
@@ -0,0 +1,65 @@
+% Package robustglossary.sty, Wilberd van der Kallen Feb 2005.
+%
+% This package is similar to robustindex.sty, but it is much simpler, as it
+% does not try to get makeindex to do anything. You are expected to convert
+% filename.glo into something usable yourself. This converted file should
+% have a different name, so that it can be \input while filename.glo is
+% being rewritten. Or you can actually paste entries into the main file, as we
+% did in robustsample.tex.
+%
+% Copyright 2005 Wilberd van der Kallen
+%
+% This file may be distributed under the conditions of the LaTeX Project Public
+% License, either version 1.2 of this license or (at your option) any
+% later version. The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.2 or later is part of all distributions of LaTeX
+% version 1999/12/01 or later.
+
+\ProvidesPackage{robustglossary}
+ [2005/02/23
+ glossary entries with pagerefs]
+
+\newcounter{gloctr}%
+
+\newcounter{maxgloctr}% To check if number of \glossary commands has changed.
+
+\newcommand{\glostring}{glo.}%
+
+\def\@wrglossary#1{%
+ \stepcounter{gloctr}%
+ \stepcounter{gloctr}%
+ \@bsphack \protected@write \@auxout {}{%
+ \string \newlabel {\glostring\thegloctr}{{\relax }{\thepage }%
+ \ifx\ifHy@bookmarks\undefined\else{\relax }{page.\thepage }{}\fi%
+ }%
+ }%
+ \@esphack
+ \protected@write
+ \@glossaryfile {}{\string \glossaryentry
+ {#1}{\string\glopageref{\thegloctr}}}%
+ \endgroup
+ \@esphack
+}%
+
+\newcommand{\glopageref}[1]{%
+ \ifnum\c@maxgloctr<#1\relax\setcounter{maxgloctr}{#1}\fi
+ \pageref{\glostring#1}%
+}%
+
+\AtEndDocument{%
+ \ifnum\c@gloctr=\c@maxgloctr
+ \else
+ \ifnum\c@gloctr=0%
+ \PackageWarning{robustglossary}{%
+ Package needs \string\make glossary in preamble. Detected%
+ }%
+ \else
+ \PackageWarning{robustglossary}{%
+ Glossary not up to date. Detected%
+ }%
+ \fi
+ \fi
+}%
+
+\relax