#StackBounty: #sorting #grouping #glossaries-extra #bib2gls Keep sorting local to groups for symbols in glossaries-extra with bib2gls

Bounty: 50

Consider this example:

documentclass{article}
usepackage[record,style=alttreegroup,nomain,symbols]{glossaries-extra}

begin{filecontents}{symbols.bib}
@symbol{alpha,
name = {ensuremath{alpha}},
description = {angle},
group = {greek},
}
@symbol{theta,
name = {ensuremath{theta}},
description = {for testing},
group = {greek},
}
@symbol{diffusion,
name = {ensuremath{D}},
description = {diffusion factor},
group = {roman},
}
@symbol{choke,
name = {ensuremath{mathrm{cor}}},
description = {corrected},
group = {sub},
}
@symbol{blockage,
name = {ensuremath{B}},
description = {blockage factor},
group = {roman},
}
end{filecontents}

GlsXtrLoadResources % input file created by bib2gls
[% instructions to bib2gls:
    src={symbols},
    type = symbols,
    selection = {all},%
%   symbol-sort-fallback={name},%turning off makes it worse
]

setglossarypreamble[symbols]{glssetwidest{MMM}}

begin{document}
glsxtrsetgrouptitle{roman}{Roman Letters}
glsxtrsetgrouptitle{greek}{Greek Letters}
glsxtrsetgrouptitle{sub}{Subscripts}

printunsrtglossaries % iterate over all defined entries
end{document}

It produces this results:

enter image description here

It is quickly clear what is wrong here. The sorting works globally when building the document as

pdflatex document
bib2gls document
pdflatex document

as shown here. Running bib2gls -g document did not seem to make a difference.

How can the groups be kept separate and sorting local to them, without mixing of groups?

A possible workaround I thought of would be to have different types for Roman, Greek etc. and then call them all manually (as opposed to one type for symbols). But that seems not the right way. I feel like I am very close to the solution, but the last steps I could not find help with in the doc.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.