CTAN
Comprehensive TeX Archive Network

Direc­tory support/bib2gls

README.md

bib2gls

Com­mand line ap­pli­ca­tion to con­vert .bib files to glossaries-extra.sty re­source files.

Author: Ni­cola Tal­bot (http://www.dicki­maw-books.com/)

Ap­pli­ca­tion Home Page: http://www.dicki­maw-books.com/soft­ware/bib2gls

Li­cence

Li­cense GPLv3+: GNU GPL ver­sion 3 or later http://gnu.org/li­censes/gpl.html This is free soft­ware: you are free to change and re­dis­tribute it. There is NO WARRANTY, to the ex­tent per­mit­ted by law.

Sum­mary

This ap­pli­ca­tion may be used to ex­tract glos­sary in­for­ma­tion stored in a .bib file and con­vert it into glos­sary en­try def­i­ni­tion com­mands. This ap­pli­ca­tion should be used with glossaries-extra's record pack­age op­tion. It per­forms two func­tions:

  • se­lects en­tries ac­cord­ing to records found in the .aux file (sim­i­lar to bibtex)
  • hi­er­ar­chi­cally sorts en­tries and col­lates lo­ca­tion lists (sim­i­lar to makeindex or xindy)

This means that the glos­sary en­tries can now be man­aged in a sys­tem such as JabRef, and only the en­tries that are ac­tu­ally re­quired will be de­fined, re­duc­ing the re­sources re­quired by .

The sup­ple­men­tary ap­pli­ca­tion convertgls2bib can be used to con­vert ex­ist­ing .tex files con­tain­ing def­i­ni­tions (\newglossaryentry etc) to the .bib for­mat re­quired by bib2gls.

For ex­am­ple, if entries.tex con­tains:

\newglossaryentry{bird}{name={bird},description={feathered animal}}

\newabbreviation{html}{HTML}{Hypertext Markup Language}

\newterm[plural=geese]{goose}

\newdualentry{svm}{SVM}{support vector machine}
  {Statistical pattern recognition technique}

Then do:

convertgls2tex entries.tex entries.bib

to cre­ate entries.bib.

Ex­am­ple

File entries.bib:

@entry{bird,
  name={bird},
  description = {feathered animal}
}

@abbreviation{html,
  short="HTML",
  long={hypertext markup language}
}

@dualentryabbreviation{svm,
   long = {support vector machine},
   short = {SVM},
   description = {statistical pattern recognition technique}
}

@symbol{v,
  name={$\vec{v}$},
  text={\vec{v}},
  description={a vector}
}

@index{goose,plural="geese"}

File myDoc.tex:

\documentclass{article}

\usepackage[record,abbreviations]{glossaries-extra}

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

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

First: \gls{svm}. Next: \gls{svm}.

\printunsrtglossaries
\end{document}

Doc­u­ment build:

pdflatex myDoc
bib2gls myDoc
pdflatex myDoc

(Re­place pdflatex with latex, xelatex or lualatex as ap­pro­pri­ate.)

In­stal­la­tion

The files should be in­stalled as fol­lows where TEXMF in­di­cates your lo­cal or home TEXMF path (for ex­am­ple, ~/texmf/):

  • TEXMF/scripts/bib2gls/bib2gls.jar (Java ap­pli­ca­tion.)
  • TEXMF/scripts/bib2gls/convertgls2bib.jar (Java ap­pli­ca­tion.)
  • TEXMF/scripts/bib2gls/texparserlib.jar (Java li­brary.)
  • TEXMF/scripts/bib2gls/resources/bib2gls-en.xml (English re­source file.)
  • TEXMF/scripts/bib2gls/bib2gls.sh (Unix-like sys­tems only.)
  • TEXMF/scripts/bib2gls/convertgls2bib.sh (Unix-like sys­tems only.)
  • TEXMF/doc/support/bib2gls/bib2gls.pdf (User man­ual.)
  • TEXMF/doc/support/bib2gls/examples/ (ex­am­ple files)

Note that texparserlib.jar isn't an ap­pli­ca­tion. It's a li­brary used by bib2gls.jar and convertgls2bib.jar and so needs to be on the same class path as them.

The bash .sh scripts are pro­vided for Unix-like users. They're not re­quired for Win­dows. The .1 files are man files and should be placed where man can find them. (They are cre­ated from the .pod files.)

To test in­stal­la­tion:

bib2gls --version
convertgls2bib --version

Th­ese should dis­play the ver­sion de­tails.

Source Code

In­struc­tions for com­pil­ing the man­ual and jar files are listed be­low. The source is also avail­able on GitHub, but that may be for a newer ex­per­i­men­tal ver­sion.

User Man­ual (bib2gls.pdf)

The ex­am­ples di­rec­tory needs to be ../ex­am­ples rel­a­tive to di­rec­tory con­tain­ing bib2gls.tex as the .bib, .tex and .pdf files are in­cluded in the man­ual.

xelatex bib2gls
bibtex bib2gls
bib2gls -g bib2gls
xelatex bib2gls
bib2gls -g bib2gls
xelatex bib2gls
xelatex bib2gls

JAR Files

Create the fol­low­ing di­rec­to­ries:

lib lib/resources java classes/com/dickimawbooks/bib2gls classes/com/dickimawbooks/gls2bib classes/com/dickimawbooks/texparserlib

Un­pack the zip files:

unzip -d java bib2gls-src.zip
unzip -d java gls2bib-src.zip
unzip -d java texparserlib-src.zip

Copy the .xml lan­guage file to lib/resources/

Com­pile texparserlib.jar:

cd java/lib 
javac -d ../../classes
-Xlint:unchecked -Xlint:deprecation *.java */*.java */*/*.java
cd ../../classes 
jar cf ../lib/texparserlib.jar 
com/dickimawbooks/texparserlib/*.class \
com/dickimawbooks/texparserlib/*/*.class \
com/dickimawbooks/texparserlib/*/*/*.class 

Com­pile bib2gls.jar:

cd java/bib2gls
javac -d ../../classes -cp ../../lib/texparserlib.jar *.java
cd ../classes
jar cmf ../java/bib2gls/Manifest.txt ../lib/bib2gls.jar
com/dickimawbooks/bib2gls/*.class

Com­pile convertgls2bib.jar:

cd java/gls2bib
javac -d ../../classes -cp ../../lib/texparserlib.jar *.java
cd ../classes
jar cmf ../java/gls2bib/Manifest.txt ../lib/convertgls2bib.jar
com/dickimawbooks/gls2bib/*.class

Down­load the con­tents of this pack­age in one zip archive (5.9M).

bib2gls – Com­mand line ap­pli­ca­tion to con­vert .bib files to glos­saries-ex­tra.sty re­source files

This Java com­mand line ap­pli­ca­tion may be used to ex­tract glos­sary in­for­ma­tion stored in a .bib file and con­vert it into glos­sary en­try def­i­ni­tion com­mands.

This ap­pli­ca­tion should be used with glos­saries-ex­tra.sty’s ‘record’ pack­age op­tion. It per­forms two func­tions in one:

  • se­lects en­tries ac­cord­ing to records found in the .aux file (sim­i­lar to bib­tex),
  • hi­er­ar­chi­cally sorts en­tries and col­lates lo­ca­tion lists (sim­i­lar to makein­dex or xindy).

The glos­sary en­tries can then be man­aged in a sys­tem such as JabRef, and only the en­tries that are ac­tu­ally re­quired will be de­fined, re­duc­ing the re­sources re­quired by .

The sup­ple­men­tary ap­pli­ca­tion con­vert­gls2bib can be used to con­vert ex­ist­ing .tex files con­tain­ing def­i­ni­tions (\new­glos­saryen­try etc.) to the .bib for­mat re­quired by bib2gls.

Pack­agebib2gls
Home pagehttp://www.dicki­maw-books.com/soft­ware/bib2gls/
Re­pos­i­toryhttps://github.com/nlct/bib2gls
Ver­sion1.1 2017-11-25
Li­cense GNU Gen­eral Public Li­cense, ver­sion 3 or newer
Main­tainer Ni­cola Tal­bot
Con­tained inTeX Live as bib2gls
MiKTeX as bib2gls
Topics util­ity for man­ag­ing BibTeX files
glos­sary and nomen­cla­ture sup­port
...
Guest Book Sitemap Contact Contact Author