bib2gls is a Java command line application to convert .bib files to glossaries-extra.sty resource files and simultaneously perform the indexing step. This application is available on CTAN and is now in both TeX Live and MikTeX. For help on including bib2gls into your document build, see Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build. See also the bib2gls gallery.


Latest Version: See the CTAN page for the latest stable release. Installation should be done through your TeX package manager.
Requirements: Java Runtime Environment (at least JRE 8) and at least v1.12 of the glossaries-extra package (but the newest version is recommended). When you update glossaries-extra make sure that you have the latest version of the base glossaries package as well.
Licence: GPLv3+
Documentation: User Manual (PDF)
Related Resources: bib2gls gallery and bib2gls FAQ.

Example Usage

The glossary entries are stored in a bib file. For example, the file entries.bib might contain:

  description = {feathered animal}

  long={hypertext markup language}

  description={a vector}

Here's an example document that uses this data:


  src={entries},% data in entries.bib
  sort={en-GB},% sort according to 'en-GB' locale

\Gls{bird} and \gls{goose}.


If this document is called myDoc.tex, the build process is:

pdflatex myDoc
bib2gls myDoc
pdflatex myDoc

Note that there's no makeglossaries (or makeindex/xindy) invocation, since bib2gls not only fetches the references used in the document, it also sorts the entries and collates the location lists. The information is written to a temporary file with the extension .glstex which is input by \GlsXtrLoadResources. Since the entries are defined in that file according to their sorted order, the glossary can simply be displayed using \printunsrtglossary (or the iterative \printunsrtglossaries).

You may have multiple resources with different sort methods. For example:

  src={terms},% data in terms.bib
  sort={en-GB},% sort according to 'en-GB' locale
  type={main}% put the entries in the 'main' glossary
  src={symbols},% data in symbols.bib
  sort={use},% sort according to use
  type={symbols}% put the entries in the 'symbols' glossary

There are a variety of sorting methods: locale (e.g. en for English or de-CH-1996 for Swiss-German using the new orthography), use (order of use within the document), definition (order of definition in the bib file), letter (case or case-insensitive), numerical (integer, hexadecimal, octal, binary, float, double). You can also select the field to sort by.

Note that, although bib2gls functions as an indexing application, if you really need to use makeindex or xindy (for example, you need a custom xindy rule that can't be replicated by bib2gls), then you can switch off bib2gls's indexing functions (sort={none}, save-locations={false}) and simply use it to fetch the data from the .bib file. In order to do this, you'll need the record=hybrid package option instead of just record (along with the xindy package option for xindy syntax) and use \makeglossaries and \printglossaries as usual. (Put \makeglossaries before \GlsXtrLoadResources[src={bib-files}, sort={none}, save-locations={false}].) The build process will then need to be

pdflatex myDoc
bib2gls myDoc
pdflatex myDoc
makeglossaries myDoc
pdflatex myDoc

This is because the indexing in the makeglossaries step can't be performed until the entries have been defined, and the entries can't be defined until they've been fetched by bib2gls, but bib2gls can't fetch them until the entry use has been recorded in the .aux file. In this case, the only benefits to using bib2gls is the ability to manage the entries in a system such as JabRef and the ability to pick up dependent entries that haven't been referenced in the document.

In general, it's best to avoid using the hybrid method.


This application is now on CTAN. The source code is available on GitHub.

Manual Installation

Now that bib2gls is in both TeX Live and MikTeX, installation is best done through your TeX package manager. However, if you need to manually install bib2gls for some reason, then the files should be installed as follows where TEXMF indicates your local or home TEXMF path (for example, ~/texmf/):

With Unix-like systems add a symbolic link called bib2gls somewhere on your path that links to the bash script. For example:
cd ~/bin
ln -s ~/texmf/scripts/bib2gls/ bib2gls
To test the installation run the following from your command prompt or terminal:
bib2gls --version
If you get the following message:
Fatal error: Can't find language resource file.
then check that the resources sub-directory has been correctly copied over.

Windows users can create a batch script analogous to called bib2gls.bat that contains the following:

FOR /F %%I IN ('kpsewhich --progname=bib2gls --format=texmfscripts bib2gls.jar') DO SET JARPATH=%%I
java -Djava.locale.providers=CLDR,JRE -jar "%JARPATH%" %*

(Now that bib2gls has been added to the TeX distributions for Windows, both MikTeX and TeX Live on Windows provide an executable file bib2gls.exe that you can use instead, but you need to install bib2gls via your package manager.)

Source code is available on GitHub.