BibTeX Plugin

@xUser5000 just it case you haven't seen, there are some suggestions in this comment on Github

1 Like

This comment is of huge help to me. It described precisely how to work with in-line citations. Thanks

1 Like

Hi, I just want to wholeheartedly second the idea of trying to make the Markdown syntax the plugin uses (and creates) as similar as possible to that used by Pandoc with citeproc, as Klemet suggested on the GitHub issue. Besides Pandoc, this syntax is also used by other tools like RMarkdown (which uses Pandoc internally) and Zettlr, and is the closest thing to a "standard" way to extend Markdown to handle citations that I'm aware of.

I can see the sense in the spec suggested previously of using Markdown links, e.g. [@SmithStatisticalMechanics2015](http://dx.doi.org/10.1002/andp.19053221004), since this would degrade somewhat gracefully in any Markdown editor/renderer. However, being able to render the citations fully with Pandoc or other tools seems like potentially a more useful form of graceful degradation for a lot of people (and way to avoid vendor lock-in). For me lack of interoperability with Pandoc would be a blocker to porting my research note library to Joplin.

I don't know how set in stone the original spec is on this point but I hope you can take this into consideration!

2 Likes

Unfortunately, I have to stick to the specification for now. But this can change later in the future.

Hi, I am really looking forward to see this integration. Maybe having a look at this plugin for obsidian is also helpful: obsidian-citation-plugin. I would highly appreciate to be able to set specific BibTex fields myself. I don't personally like to only being able to look a paper up online. So, an option to set a link to Zotero instead of the DOI or an URL would be amazing. Maybe adding this to the options of the Plugin could be an idea?

1 Like

Hey there !

I'm just posting here following @xUser5000 response on a comment I made on GitHub, concerning the way that markdown-it should ideally handle quotes. The idea was that it should replicate, as best as possible, the behaviour of the citeproc plugin of Pandoc, that handles citations. This is because citeproc gives a very flexible syntax that allows citations in the text to take very different forms, which I find really awesome !

I made a small test file to test the different aspects of the syntax to see what Pandoc did with it, using the markdown-preview-plus plugin of the text editor Atom, which allows to use Pandoc with custom arguments to preview the output of a markdown file.

Here, I'll paste the outputs of Pandoc so that one can see how it works. The syntax's rules are summarized on this page.


Testing citations with Pandoc

@dijkstraNoteTwoProblems1959

This is shown by Dijkstra (1959).

[@dijkstraNoteTwoProblems1959]

This is shown by (Dijkstra 1959).

-@dijkstraNoteTwoProblems1959

This is shown by -Dijkstra (1959).

[-@dijkstraNoteTwoProblems1959]

This is shown by (1959).

-[@dijkstraNoteTwoProblems1959]

This is shown by -(Dijkstra 1959).

@dijkstraNoteTwoProblems1959 and @dijkstraNoteTwoProblems1959

This is shown by Dijkstra (1959) and Dean (1997).

[@dijkstraNoteTwoProblems1959 and @deanFindingOptimalRoutes1997]

This is shown by Dean (1997).

[@dijkstraNoteTwoProblems1959; and @deanFindingOptimalRoutes1997]

This is shown by (Dijkstra 1959; and Dean 1997).

[@dijkstraNoteTwoProblems1959; and -@deanFindingOptimalRoutes1997]

This is shown by (Dijkstra 1959; and 1997).

@dijkstraNoteTwoProblems1959 [p. 33]

This is shown by Dijkstra (1959, 33).

@dijkstraNoteTwoProblems1959 [pp. 33-35, 38-39]

This is shown by Dijkstra (1959, 33–35, 38–39).

@dijkstraNoteTwoProblems1959 [chap. 1 pp. 33-35]

This is shown by Dijkstra (1959, chap. 1 pp. 33-35).

Dean, D J. 1997. “Finding Optimal Routes for Networks of Harvest Site Access Roads Using GIS-Based Techniques” 27: 12.
Dijkstra, E. W. 1959. “A Note on Two Problems in Connexion with Graphs.” Numerische Mathematik 1 (1): 269–71. https://doi.org/10.1007/BF01386390.

I hope this will be useful !

3 Likes

This looks pretty good.

But again, Joplin is a note-taking application with synchronization capabilities; it is not a reference management tool like Zotero. This plugin just serves as middleware between reference management software and Joplin by importing and listening to changes affecting local BibTeX files. If you want to edit the BibTeX fields, do it with Zotero.

1 Like

But again, Joplin is a note-taking application with synchronization capabilities

This is what I like it for. Zotero has URIs for each element, making it possible to link to these elements from somewhere. These URIs can also be exported with the BibTex files.

Maybe adding this to the options of the Plugin could be an idea?

Here I meant the config screen: BibTeX Plugin: UI/UX Document

My intention was to add the URI to the citation (as it is accessible in the BibTex file) instead of the DOI or an URL.

As I don't use Joplin to publish my notes, I rather prefer to link to my files than having a link to a website. If I collaborate on a note it could be handy to have the DOI. This is why I suggested a field in your config screen to make it possible to choose. If you have a closer look at that Obsidian Plugin it might get more clear what I mean.

Thank you a lot of taking care of this Plugin anyways.

2 Likes

Excellent! One thing worthy of note is how Zettlr (repo: GitHub - Zettlr/Zettlr: A Markdown Editor for the 21st century.) uses the bibTex plugin from Zotero. Bear in mind that many here are using Zotero in parallel with Joplin, and that this plugin will be wonderful for importing any hot citations via the Zotero BibTex export option.

5 Likes

OK, this looks good. I might include it at the end.

Just as a tips, You should also try to support:

  • CSL JSON
  • Better CSL JSON
  • BetterBibTeX JSON
  • CSL YAML

While I mostly agree, I want to point out that a large portion of my (and probably also others) notes actually is about literature. I hate saving notes in jabref/zotero and I love Joplin for that. But I also hate keeping redundant structures.

So being able to reference notes is a great and important feature to have, it only covers half of the/my equation.

Can you comment on how difficult it would it be to implement something that also manages references as metadata? Could this be added as an add-on later?

The library I'm gonna use already supports CSL JSON but I don't know about the other formats. Maybe this can be a stretch goal.

1 Like

I'm not an expert, but I think it is relatively challenging and time-consuming because, obviously, we are trying to replicate the job of an entire application.

I am not sure about the differences, I just know that it is recommended to use them when using the Better BibTeX plugin for Zotero, I think it's only finetuning of the CSL JSON format.
Here is some linke regarding Better CSL and Better BibTeX for Zotero.

Maybe it can be of help and interest for your project.

It is great that you are making this plugin for Joplin.

Better BibTeX for Zotero :: Better BibTeX for Zotero (retorque.re)
this explain some of it:
Bundled translators :: Better BibTeX for Zotero (retorque.re)
github:
retorquere/zotero-better-bibtex: Make Zotero effective for us LaTeX holdouts (github.com)

2 Likes

I tend to agree. As the amount of work that can go in this plugin is limited, I think that leaving the referencing to a software such as Zotero would be best.

I still understand @franzperdido 's view, as I'm not a fan of the Zotero note system either, but I still like to make notes on what I read. But I'd hate to have to re-invent the wheel when Zotero is open-source, manages all kind of meta-data or documents, have plugins, integrates with word processors, and have amazing plugins like better bibtex or the navigator integration. It seems pretty obvious that it will be impossible to replicate all of these features, making Joplin half-complete in comparison whatever is done from my point of view.

Maybe a compromise can be found, though ! If the BibTeX plugin is capable of reading a CSL JSON or a .bib file to take it into account as a database of references, maybe it would be possible to make an option like "Create a note for every reference in the database" ?

For example, if I have 3 references in my database, choosing this option would make it so that the BibTeX plugin would create 3 new joplin notes in the notebook of my choice. Each note would be titled with the tittle of the paper and the authors names (or something else, like the citekey), and the keywords associated to the references in the database could even be passed on to the notes. Since the plugin will certainly have to watch for changes in the CLS JSON or .bib file, maybe those changes could automatically result in new notes being created for references that are added to it.

It's just a suggestion, though; and I think that @xUser5000 already has a lot of work on their shoulder : ). It will still be absolutely amazing to have a tool that allows for reading a database of references, cite then in text flexibly, and parse it properly. Thank you for your work !

3 Likes

A great suggestion. I think this can be developed as a separate plugin. What do you think?
Also, what if the number of references is big, say 50? Do I have to open 50 notes for every reference? Why not just open a single note for the entire file? And also you have to solve the problem of the markdown because, clearly, BibTeX != Markdown.

Mmmh...I'm not sure about that.

Basically, such a plugin will have to be able to 1. Read a CLS JSON/.bib file, 2. Extract some info from it to put them into notes, and 3. Watch for changes in this file. Since those 3 functions are going to be in the BibTeX plugin no matter what, I deem it a bit redundant to implement them in another plugin. It could, however, become an update to the plugin in the future ?

In my idea, the plugin would create one note per reference, hence 50 notes for 50 references. The notes can be left empty, of course. However, I think that 1 reference = 1 note would be crucial to search and retrieve them faster, especially thanks to the keywords associated to them in the CLS JSON/.bib database that could be transformed into Joplin tags.

1 Like

Ok, that looks good.

I also think replacing zotero is probably a bit an overkill for this plugin and might be better with perfect workflow integrations, like plugins for both. Maybe a future version or a different plugin could directly read from zoteros sqlite database or via its api. For me the newest beta version already improved pdf annotations. Need to see if/how I will include those annotations.

I don‘t know if importing a full BibTex file is something I‘d want to do, as I am not taking notes on every reference I have. Though, I hope this Plugin will help me to improve this.

Maybe a comparison of unique citekeys would be a solution to handle that, as already mentioned by @Klemet . It could simply add the new entries to a literature notebook with the citekey as note title.
Maybe also something like a specific batch import function could handle this task? I think a possibility to set up a note template would be very useful for these use cases. The obsidian citation plugin I mentioned previously handles this task nicely.
I think there are multiple solutions to handle these diverse use-cases, as there‘s a plethora of different workflows and preferences. A possibility to switch certain workflows on and off could be a solution to handle all these needs. Maybe an important point here on your coding would be to make it as easy as possible for others to contribute additional functionality to your plugin in the future.

Looking forward to hear your thoughts about this.

2 Likes