feat(glossaries): add glossary support with custom style for main glossaries entry and location header

Closes 84
This commit is contained in:
nuluh
2025-06-03 20:52:54 +07:00
parent ff862d9467
commit 8d1edfdbf7

View File

@@ -25,6 +25,7 @@
\RequirePackage{indentfirst} % Makes first paragraph after headings indented \RequirePackage{indentfirst} % Makes first paragraph after headings indented
\RequirePackage{float} % Provides [H] option to force figure/table placement \RequirePackage{float} % Provides [H] option to force figure/table placement
\RequirePackage[style=apa, backend=biber, language=indonesian]{biblatex} \RequirePackage[style=apa, backend=biber, language=indonesian]{biblatex}
\RequirePackage[acronym, nogroupskip, toc]{glossaries}
% Polyglossia set language % Polyglossia set language
\setdefaultlanguage[variant=indonesian]{malay} % Proper Indonesian language setup \setdefaultlanguage[variant=indonesian]{malay} % Proper Indonesian language setup
\setotherlanguage{english} % Enables English as secondary language \setotherlanguage{english} % Enables English as secondary language
@@ -170,4 +171,35 @@
% % \pagestyle{fancyplain}% switch for subsequent pages % % \pagestyle{fancyplain}% switch for subsequent pages
% % } % % }
% Define the header for the location column
\providecommand*{\locationname}{Location}
% Define the new glossary style called 'mylistalt' for main glossaries
\makeatletter
\newglossarystyle{mylistalt}{%
% start the list, initializing glossaries internals
\renewenvironment{theglossary}%
{\glslistinit\begin{enumerate}}%
{\end{enumerate}}%
% suppress all headers/groupskips
\renewcommand*{\glossaryheader}{}%
\renewcommand*{\glsgroupheading}[1]{}%
\renewcommand*{\glsgroupskip}{}%
% main entries: let \item produce "1." etc., then break
\renewcommand*{\glossentry}[2]{%
\item \glstarget{##1}{\glossentryname{##1}}%
\mbox{}\\
\glossentrydesc{##1}\space
[##2] % appears on page x
}%
% sub-entries as separate paragraphs, still aligned
\renewcommand*{\subglossentry}[3]{%
\par
\glssubentryitem{##2}%
\glstarget{##2}{\strut}\space
\glossentrydesc{##2}\space ##3%
}%
}
\makeatother
\endinput \endinput