Latest news 2021-06-05: New blog post: Dickimaw Books Site Account.

bib2gls application FAQ

How do I sort by group? 🔗

You don’t (usually). The group field is an internal field that’s designed to be set by bib2gls. When you invoke bib2gls with the --group switch, most of the sort methods will assign the group field as a by-product of sorting.

It is possible to assign a custom value to the group field, but if you do this you must ensure that the entries are ordered in such a way that the groups aren’t broken up. This is typically done by separating the glossary into logical blocks through the use of multiple instances of \GlsXtrLoadResources with the group option set.

Technically it is possible to change the field used for sorting to group but the value of the group field must always be a label. The corresponding title is set in the document where it’s not visible to bib2gls. This means that at most you can only sort by the label not by the title.

If you find yourself wanting to order by group then that’s a strong indication that you have a hierarchical glossary and you should be using the parent field instead. You just need to find an appropriate glossary style.

Compare, for example, sample-textsymbols.tex and sample-textsymbols2.tex, both of which use miscsymbols.bib. The first case sorts by the group label and sets the sort suffix to the description field. The second case uses a hierarchical approach that sorts the topic (top-level @index and @indexplural entries) by name and sorts the symbols by their description. The second method is the simpler and better approach that will work with non-English languages.

See also Logical Glossary Divisions (type vs group vs parent).

2020-06-29 12:31:39


Permalink: https://www.dickimaw-books.com/faq.php?id=230
Alternative link: https://www.dickimaw-books.com/faq.php?itemlabel=groupsort

Category: bib2gls application
Topic: Sorting