593 private links
A small wrinkle when using bib2df
together with bib2gls
: the latter does not tolerate empty cross-reference fields.
bib2df::df2bib()
takes a tibble and generates the entries.bib
file, and since the tibble by necessity contains one column for each field, any entries with empty see
fields get converted by bib2df::df2bib()
to see={}
. The presence of any glossary entry with an empty see={}
field causes bib2gls
to fail:
Processing resource thesis-1.glstex.
Parsing fields for entry 'absorption_coefficient'
Checking field aliases for absorption_coefficient.
Value=>user1={}
>> name={{}\ensuremath{\alpha}}
=>> name={{}\ensuremath{\alpha}}
>> first={absorption coefficient, \ensuremath{\alpha}}
=>> first={absorption coefficient, \ensuremath{\alpha}}
>> text={absorption coefficient}
=>> text={absorption coefficient}
>> description={absorption coefficient}
=>> description={absorption coefficient}
>> user1={}
=>> user1={}
>> see={}
=>> see={}
Checking cross-references for: absorption_coefficient
Field alias not set.
Error: EOFException
com.dickimawbooks.texparserlib.TeXParser.popStack(TeXParser.java:2635)
com.dickimawbooks.texparserlib.TeXObjectList.popArg(TeXObjectList.java:1294)
com.dickimawbooks.texparserlib.TeXObjectList.popArg(TeXObjectList.java:1275)
com.dickimawbooks.bib2gls.Bib2GlsEntry.initSeeRef(Bib2GlsEntry.java:4710)
com.dickimawbooks.bib2gls.Bib2GlsEntry.initCrossRefs(Bib2GlsEntry.java:4694)
com.dickimawbooks.bib2gls.GlsResource.processBibList(GlsResource.java:6722)
com.dickimawbooks.bib2gls.Bib2Gls.process(Bib2Gls.java:2706)
com.dickimawbooks.bib2gls.Bib2Gls.main(Bib2Gls.java:6616)
As you can see, other fields may be empty, but not the see
field.
This is not a bug in either bib2df::
or bib2gls
, and I don't expect either project to "fix" this issue. The former is not meant for and has no notion of glossaries, and the latter is not really expecting us to be generating the .bib
file, so why should there be empty see
fields?
To work around this I suggest removing all lines with see={}
fields from the entries.bib
file, here an example using sed:
sed -i '"/[Ss]ee\s*=\s*{}/d" entries.bib
I simply added this sed
command to the R chunk that calls bib2df::df2bib()
.
I should probably add that my reason for generating the glossary bib-file from R in the first place was to make use of the excellent constants
library.
Notes and links
This behaviour was observed on Ubuntu 22.04, R 4.1.3, TeXLive 2022, glossaries-extra 1.50, bib2gls 3.2, bib2df 1.1.1.