Embed .bib (or zotero collection) inside note

Zotero allows us to export a live-updated .bib for collections. It would be great to be able to embed .bib files into zotero notes.

edit: I developed a working python script to accomplish this. I’ve shared the script development on Github and would love to hear your thoughts and ideas. Feel free to contribute.

GitHub

GitHub - huachuman/BibTeX-to-MD: A versatile python script that converts and…

A versatile python script that converts and cleans BibTeX files, renaming them to .bib.md for embedding in Obsidian - GitHub - huachuman/BibTeX-to-MD: A versatile python script that converts and cl…

Note: this is designed specifically to synergize with the PrettyBibTeX and the Pandoc Reference List plugins, but can easily be modified for other purposes.

1 Like

I’m not sure I see the use case for something like this. If you are exporting a .bib file to get a list of references, you will be better served by having in-text references linking to your references section which you can achieve via the Citations plugin + Pandoc export. If you only want to insert a list of references and don’t care about in-text linking, you can just export the references you want from Zotero to clipboard properly formatted however you have configured Zotero to do it and paste them into Obsidian. But maybe I am missing something :slight_smile:

1 Like

The point is that these collections are live updated when you add an item in zotero. So embedding the .bib would add citations to a note when they are added to zotero.

The idea is not to have in-text references, but a bibliography of relevant information that is updated when things are added to it.

e.g. I have a note on “rest-stimulus interaction” and also a zotero collection by the same name. The idea is I would embed that zotero collection using a live-export .bib at the bottom of the obsidian note to have a glance at what else I could be reading on the topic.

If I just copied my references the way you’re suggesting, well that’s just a list… it has no auto-update functionality. This is not even close to an alternative to what I am suggesting.

2 Likes

Gotcha! Thanks for explaining. I don’t know of any plugin that will do something like this for you but it certainly sounds useful.

1 Like

This would be awesome! Since I’m still relatively software naive (despite years using LaTeX), I have some clarifying questions and then a related thought.

When you say embedding a .bib file, do you mean something like adding it to a particular note in a similar way to embedding an image?

Other than a desire to see a summary of the research in the .bib file in the context of the note you’re working on, would that be substantially different from storing the live-updated .bib in your vault and linking to it from your desired note? Or are there some limitations to the live-updating that I don’t understand?

Edit: Ope, I think I understand. .bib isn’t currently an accepted file format.

Even so, I just added an auto-updating .bib file from Zotero to my Obsidian vault and embedded a link to it from another note. I specified my vault as the save destination when exporting the .bib file from Zotero, so I’m not sure if it’s possible to import it directly through Obsidian’s interface.

The .bib doesn’t show show up in Obsidians in-app file navigator. Neither does it show a list of its contents within the note itself, it just looks like this:

Clicking its link opens a Bibdesk window showing those references.

Adding more items to the relevant collection in Zotero successfully updated the .bib file in my vault. So there’s some degree of the functionality that you were looking for.

As an aside, this could be a boon to anyone using pandoc to convert notes with citations to .tex files or pdfs, since you wouldn’t have to collect copies of all your notes and .bib files into a new single directory to compile them.

I’m messing around with this idea. Here’s where I’m at so far:

.bib files can be converted to .md files just by changing the extension. At that point, obsidian can read them. However, they are ugly as sin.

Now there is an extension called prettybibtex. The catch is you have to wrap each entry in three backticks with bibtex beside it.

I managed to create a python script that will do this, and also remove entries that you don’t want.

It’s working very well right now.

All I have left to do is finish the script so that it does the copy operation and have it change the extension from .bib to .md. This is the easiest part which is the reason I took a break from building this yesterday.

After that, I will set it to perform this operation on a schedule, or something like that, so that the converted bib files (now .md files) will be updated at a daily interval (or manually triggered with an inline button attached to the script or something like that).

Most likely I will have this finished over the weekend and will share my setup along with the code etc.

1 Like

Not that this solve what you are looking for, but to see the .bib file on the explorer you have to activate settings>files & links > detect all file extensions

2 Likes

I’ve shared the script development on Github and would love to hear your thoughts and ideas. Feel free to contribute!

Note: this is designed specifically to synergize with the PrettyBibTeX and the Pandoc Reference List plugins, but can easily be modified for other purposes.

1 Like