% arara: pdflatex
% arara: pdflatex
% arara: makeglossaries
% arara: bib2gls
% arara: pdflatex
% arara: clean: { extensions: [acn, acr,alg, aux, glg, glo, gls, ist, out, slg, syg, syi, toc, idx, ind, log, ilg, glstex, bib, syntex, syntex(busy), gz ] }
\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage[record,% using bib2gls
index,% create 'index' glossary
abbreviations,% create 'abbreviations' glossary
postdot,% insert dot after descriptions
nostyles,%don't load predefined styles
stylemods={tree,bookindex},% load the 'tree' and 'bookindex' style packages
style={tree}% set the default style to 'tree'
]{glossaries-extra}
\setabbreviationstyle[common]{short} % set abbreviation style before \GlsXtrLoadResources
\GlsXtrLoadResources[
src={terms},% data in terms.bib
label-prefix={idx.},% prefix for primary entry labels
dual-prefix={},% prefix for dual entry labels
type=index,% put primary entries in 'index' glossary
combine-dual-locations={primary}% merge locations and assign to primary list
]
% provide commands that work like \gls etc for the @index entries
% (that don't have a dual counterpart)
\glsxtrnewglslike{idx.}{\idx}{\idxpl}{\Idx}{\Idxpl}
\begin{document}
\section{Sample}
First use \gls{debs} and \gls{p2p}. Next use: \gls{debs} and
\gls{p2p}.
No expansion: \gls{http}.