yymao/adstex

Failed to update arxiv items in existing bib files

syrte opened this issue · 6 comments

syrte commented

When I run
adstex main.tex -o main.bib -r mylib.bib --merge-other --force-regenerate

It failed to update the following items from the existing mylib.bib file (which is exported from zotero)

@article{Simon2019,
  title = {The {{Faintest Dwarf Galaxies}}},
  language = {en},
  journal = {arXiv e-prints},
  url = {https://ui.adsabs.harvard.edu/abs/2019arXiv190105465S/abstract},
  author = {Simon, Joshua D.},
  month = jan,
  pages = {arXiv:1901.05465},
  year = {2019}
}
@article{Richings2018,
  title = {Subhalo Destruction in the {{Apostle}} and {{Auriga}} Simulations},
  language = {en},
  journal = {ArXiv e-prints},
  url = {https://ui.adsabs.harvard.edu/\#abs/arXiv:1811.12437},
  author = {Richings, Jack and Frenk, Carlos and Jenkins, Adrian and Robertson, Andrew},
  month = nov,
  pages = {arXiv:1811.12437},
  year = {2018}
}

Usually, the arxiv number should be given as eprint for ads entries. Not sure why these items are not in the standard format. I can fix it by adding the following block at the end of the function entry2bibcode.

    if "pages" in entry and entry['pages'].lower().startswith('arxiv:'):
        s = fixedAdsSearchQuery(arxiv=entry["pages"].split(':')[1], fl=["bibcode"])
        try:
            return next(s).bibcode
        except StopIteration:
            pass

I'm satisfied with my solution for now. If you feel it could be a general problem for others, you can take it into your code. Thanks.

yymao commented

Thanks for the report @syrte. If you have a chance to try out #17 that'd be great. I'll merge it later today.

syrte commented

Thanks for the update, it's nice to have such extensibility.

Hmm, the page here

("page", "arxiv"),

should be pages. Then it works in my case.

syrte commented

BTW, a space is needed in "FOUND IN SECONDARY BIB SOURCES," -> " FOUND IN SECONDARY BIB SOURCES,"

adstex/adstex.py

Lines 406 to 410 in f19cbcc

"{}:{} UPDATE => {}".format(
key,
"" if key_exists else "FOUND IN SECONDARY BIB SOURCES,",
bibcode_new,
)

yymao commented

Thank you for testing it out and providing solutions @syrte! Should all be fixed in #17 now.

syrte commented

And I have another question, the bib file generated by adstex always starts with

@string{june = {June}}

Is this necessary? Or just to test the bparser?

yymao commented

Ah, this is another hack for some specific bibtex generator (but I forget which). The correct way to specify the month June in bibtex should be

month={June},

or

month=jun,

But some bibtex sources use

month=june

which is not standard bibtex. This prefix fixes this.