Allow references to be inserted as Plain Text, not just as LibreOffice field codes

In my experience, by far the biggest limitation of JabRef is that references are inserted into documents as LibreOffice field codes, which are incredibly fragile. If I move a paragraph with cut and paste, the field codes are removed and I have to enter them again from JabRef. If I export to .doc or .docx they also don’t survive. I am forever reinserting references that got lost. This could very easily be resolved if there was a feature that made it possible to convert references as field codes into references that are plain text, for example using a latex convention. I click one button to switch into plain text mode, any existing reference list is removed, all my libreoffice field code objects are converted into something “\cite{refKey}” plain text strings. While I am in plain text mode, new citations are also inserted in this plain text format. I can copy and paste and export to whatever I like and back and nothing gets lost. When I am ready to create a pretty final output I click another button to switch back into fieldcode mode and the plain text references are converted back to pretty but fragile field code objects and the reference list is recreated. Such a feature would solve so many headaches!

That’s an interesting feature request and I can understand the struggle, but it seems it’s not possible as it’s not implemented in LibreOffice and I don’t see any way how JabRef could track the fields/update then.

I also like the idea. It reminds me of Bibliographix. In Bibliographix, citations are inserted as plain text: e.g. [=2-Akerlof (1970)=], where the number refers to the reference type (e.g. in text citation) followed by the citekey. The references are not tracked/updated as long as the document is finished. At the end, the whole document is compiled by bibliographix, changing the code to the proper references.

In principle, JabRef could be used in a similar way, by using "\cite{refKey}” during the writing process. What is missing, however is a routine/macro that converts "\cite{refKey}” into a libreoffice field code after the document is finished. I think someone with better knowledge about libreoffice than me should be able to create such a macro.

As a starting point, one needs to know, how to create a libreoffice field, that mimics the libre office field used by jabref?

For reference, these are the two classes that manage the inserting of the text into LO

JabRef uses these fields types that are called “ReferenceMark” in the API.


The past days, I have worked on a solution to your problem. I have created a macro that can convert ReferenceMarks created by JabRef to plain text citation keys and vice versa.
In principle you can use this method to work on your manuscripts in Word and compile the document at the end with libre office. For an easy integration one can just use the build in \cite{Key} function in JabRef

Here is the picture after converting:

As you see, Jabref can process the references and create a literature list properly. Of course, the other way around is also possible, so you can keep your references when using MS-Word.

May be I can send you the code for testing.

@teertinker That is cool! It would be cool if we can put the code somewhere avaiable for all users.

This looks very cool! How can I get my hands on this functionality?

It took a little bit longer than expected. Below you can find the result. I did create a LibreOffice extension which hopefully works. You can download the extension and the sourcecode at:

1 Like

Very awesome. I shall test. :smiley: