From cbd1673e680c2f55eb60458dd4ecbb5c2060838f Mon Sep 17 00:00:00 2001
From: Loek Le Blansch <loek@pipeframe.xyz>
Date: Fri, 13 Sep 2024 16:06:41 +0200
Subject: hide glossary if no glossary entries used

---
 projdoc.cls | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

(limited to 'projdoc.cls')

diff --git a/projdoc.cls b/projdoc.cls
index 388f901..cc25e67 100644
--- a/projdoc.cls
+++ b/projdoc.cls
@@ -206,19 +206,23 @@
 	\thispagestyle{empty}
 	\end{titlepage}
 }
-\newbool{projdoc@cited}
-\apptocmd{\abx@aux@cite}{\global\booltrue{projdoc@cited}}{}{}
+\newbool{projdoc@used@cite}
+\newbool{projdoc@used@gls}
+\apptocmd{\abx@aux@cite}{\global\booltrue{projdoc@used@cite}}{}{}
+\apptocmd{\glsxtr@record}{\global\booltrue{projdoc@used@gls}}{}{}
 \def\projdoc@trailer{
 	% bibliography (if citations used)
-	\ifbool{projdoc@cited}{\printbibliography}{}%
+	\ifbool{projdoc@used@cite}{%
+		\printbibliography%
+	}{}%
 	% glossary
-	\ifcsundef{printunsrtglossary}{}{%
+	\ifbool{projdoc@used@cite}{%
 		\section*{Glossary}%
 		\begin{multicols}{2}%
 			\renewcommand{\glossarysection}[2][]{}%
 			\printunsrtglossary%
 		\end{multicols}%
-	}%
+	}{}%
 }
 \AtBeginDocument{\projdoc@header}
 \AtEndDocument{\projdoc@trailer}
-- 
cgit v1.2.3

