Create .bib file only from papers cited in a .tex file?

I have a particularly large Zotero library, which tends to generate a large bib file, which is updated automatically. Troubleshooting tends to be a pain.

Would it be possible to only create a bib file from the items that are /cite'd in a particular manuscript/tex file?

(if it helps, my tex editor is Atom with a bunch of plug-ins)
  • Not sure what you're referring to. Zotero doesn't have a feature to auto-generate a bib file.

    If you're using a third-party extension (Better BibTeX?), you'd need to ask the extension developer.
  • This is possible using BBT with a little effort on your part; you compile your manuscript as usual, then import the aux file that was produced by opening the Tools menu in Zotero and selecting Scan BibTeX AUX file. This will create a new collection containing only the references used in the manuscript. You could then in turn export this collection to a bib file and you'd have just the papers you referenced there.
  • Just wanted to add to emilianoeheyns comment. The new version of Zotero does not create a collection---it creates a tag. You'll need to search for a tag and that'll display all the citations which you can just select and export as a .bib file.
  • I'm not sure what scenario you are describing? Zotero doesn't automatically tag items you cite.
  • So I was able to go to Tools → Scan BibTex/Markdown file for References and point Zotero (or BetterBiBTex) to the markdown file location. After that, Zotero displayed a popup box where I had to type a name for the Tag.

    I was then able to search/find the tag in zotero. When I click on the tag, it displayed all the entries that were present in the markdown file. I simply selected them and exported them as .bib.
  • That is indeed BBT. If you right-click a collection, you get the same option, but it will scan into that collection instead of tagging the items.
  • edited April 5, 2023
    Hi all, thanks for this useful thread. I was just dealing with the exact same issue but after I scanned the AUX file Zotero just created a new sub collection with no files in it except a Note saying

    **BibTeX AUX scan**

    Missing entries:

    - 0

    I got the AUX file from Overleaf but I also tried to locally generated it from VS Code with my LaTeX file etc.. Is there any similar issues that ppl are encountering? If anyone knows how to deal with this it'd be great! Thanks!

    Update: I figured it out. I'd need to generate a full bib file to compile the LaTeX doc so that I get a correct AUX file.
  • I get totally lost.

    For zycyc's comment- Aren't we talking about creating a .bib file? I actually get the same "Missing entries" note. But you are saying we create a .bib file first??

    For ajcj's comment- I tried to use pandoc to convert .tex to .md but I cannot choose any .md files after clicking "Scan BibTex/Markdown file for References" (where only .aux is clickable). I'm using a Mac.
  • Support for BBT happens on github, not here. I had entirely missed the april 5 and the following message. I'll follow up on the issue you created there.
  • @boyoungzheng it's been a while since I posted that but I think I was referring to: first export full bib -> compile LaTeX -> get AUX -> scan AUX into Zotero -> get cited collection -> export that collection

    hopefully this helps.. it's a bit convoluted tho
Sign In or Register to comment.