% !TEX root = ../HSRTReport.cls
% ==============================================================================
% Glossary Configuration Module
% ==============================================================================
% Description: Glossary and acronym list configuration and styling
% Author: Frederik Beimgraben
% License: Creative Commons CC BY 4.0
% ==============================================================================

% ==============================================================================
% Glossary Initialization
% ==============================================================================
\makeglossaries

% ==============================================================================
% Column Type Definitions
% ==============================================================================
% Define custom column types for glossary tables
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}

% ==============================================================================
% Custom Glossary Style
% ==============================================================================
\newglossarystyle{manualfixedwidth}{
	\setglossarystyle{long3colheader}
	\renewenvironment{theglossary}
	{\begin{longtable}{
				@{}
				L{0.30\textwidth-\tabcolsep}
				p{0.58\textwidth-\tabcolsep}
				L{0.10\textwidth-\tabcolsep}
				@{}
			}}
			{\end{longtable}}
	\renewcommand*{\glsgroupskip}{}
	\renewcommand{\arraystretch}{1.1}
}

% Apply the custom glossary style
\setglossarystyle{manualfixedwidth}

% ==============================================================================
% Glossary Labels and Settings
% ==============================================================================
% German labels for glossary columns
\renewcommand*{\entryname}{Wort/Abkürzung}
\renewcommand*{\descriptionname}{Bedeutung}
\renewcommand*{\pagelistname}{Seite(n)}

% Enable hyperlinks in glossary
\glsenablehyper

% Disable page breaks between glossary groups
\renewcommand*{\glsclearpage}{}

% German name for acronym list
\renewcommand{\acronymname}{Abkürzungsverzeichnis}

% ==============================================================================
% Custom Glossary Keys for German Grammar
% ==============================================================================
% Source: https://golatex.de/viewtopic.php?t=23348
% These keys enable proper German declension in glossary entries

% ------------------------------------------------------------------------------
% Genitive Case (Genitiv)
% ------------------------------------------------------------------------------
\glsaddkey
{genitive}% key
{}% default value
{\glsentrygenitive}% no link cs
{\Glsentrygenitive}% no link ucfirst cs
{\glsgen}% link cs
{\Glsgen}% link ucfirst cs
{\GLSgen}% link all caps cs

% ------------------------------------------------------------------------------
% Dative Case (Dativ)
% ------------------------------------------------------------------------------
\glsaddkey
{dative}% key
{}% default value
{\glsentrydative}% no link cs
{\Glsentrydative}% no link ucfirst cs
{\glsdative}% link cs
{\Glsdative}% link ucfirst cs
{\GLSdative}% link all caps cs

% ------------------------------------------------------------------------------
% Shortcut command for \acrshort
% ------------------------------------------------------------------------------
\newcommand{\acr}{\acrshort}
