2

I am looking for an advice.

I am trying to find "the best" (:>) program to manage my bibtex library which would let me create subgroups and format citation keys my way, e.g. ref:[author][year][a-z]; e.g. ref: followed by author, followed by year, followed by letters a, b, c if there are key duplicates.

First was JabRef. It would be ok but I work on CentOS and unfortunately JabRef does not work well on this system.

I tried KBibTeX which is fine but it a slightly too simple. Formatting citation keys is OK but it does not handle duplicates. I had to add first letters of title to the keys: ref:authorYearFLOT (First Letters of Title). If the title is long than the key gets quite long as well. The other problem is no groups and subgroups management.

Zetero has group managing, cloud syncing but bibliography has to be manually exported to bibtex file. It also has inconvenient citation keys formatting "author_year_firstwordoftitle". It handles the duplicates somehow but it is not the way I would like it. I would prefer to have "ref:" prefix in my key citations.

Mendeley has option to handle BibTeX by syncing separate folders into separate *.bib files, which is good. If there is a missing citation key, it provides it using "AuthorYear[abc...]" format but sometimes it gives something else like "Author:VMM1998475:word1:word2". I could not find how to edit a style that citation keys would follow.

Is there any add-on for Mendeley to handle custom citations?

Thanks for any advises.

EDIT. Even though Mendeley can sync references (in my case folders) with bibtex files, I still don't know when exactly they are synced. As I found a workaround with Zotero (see my answer), I am going to switch to this program. Currently, references have to be exported manually but at least I control it!

8
  • Incidentally, I was researching automatic cite key generation methods yesterday and I've found the following article about method used in Better bibtex plugin for Zottero. So I think that this plugin can fix issues you have with Zotero.
    – michal.h21
    Oct 28, 2017 at 20:42
  • I installed Zotero 5 and this plugin is available only for version 4. Have you tried both versions? Are there significant differences between 4 and 5? Ty
    – Celdor
    Oct 29, 2017 at 1:50
  • Zotero has been rewritten from scratch because it used to be based on Firefox extension system, which will be abandoned in Firefox 57. So Zotero 4 will die, as other most successful Firefox extensions. It seems that Better Bibtex support for Zotero 5 is on the way. It should be possible to install the development version already. But I haven't tested it.
    – michal.h21
    Oct 29, 2017 at 13:23
  • JabRef people are pretty quick to fix problems. I woudn't give up on that one. Others hardly ever come close to JabRef in my personal opinion. Besides it is open source which is a big difference for me.
    – percusse
    Oct 30, 2017 at 10:41
  • I wouldn't mind using JabRef. I have a problem run it on CentOS which has installed an open source Java version (OpenJDK). It has also something to do with JavaFX and I still don't know how to install its open source version. Java TM (from Oracle) has it included and I did try to put both JabRef and Java TM together but JabRef was not very stable.
    – Celdor
    Oct 30, 2017 at 10:51

2 Answers 2

4

You can do all this by using Zotero with the Better BibTeX plugin -- the pre-release is stable, it's just not feature-complete. But the things you describe are ready, and doesn't require manually editing translator files which may be reset when Zotero updates them.

8
  • I tested it this morning. It's exactly what I'd need. I like when it updates libraries on change and to be able to controlling what is exported and when. I tested it on my already created collection. During export, it did not respect my changes to style of citation keys. I set it to "ref:[author][year]" and nothing happened. Than I made a change in one filed and then it changed citation key but only for that reference. Eventually I had to explicitly recreate citation keys.
    – Celdor
    Nov 4, 2017 at 10:27
  • It's a little odd ad not consistent. It should either update everything or nothing during export. I understand some users may have old references and create new ones. Then program would respect old citation keys and follow the new style for the new references but it does not do that. It "update" citation key for those references which are altered. To me it should be controlled. That's my feedback
    – Celdor
    Nov 4, 2017 at 10:35
  • It's in fact very consistent - it's just got a consistency you don't like. Changing the pattern will change the citekey for references that change from that point on. I don't want it to change keys for stuff I already use, and besides that, the performance implications of changing all citekeys at once are significant. If you want to change all citekeys, select all your references, right-click, and select "refresh".
    – retorquere
    Nov 4, 2017 at 14:59
  • I understand you disagree but if you have stuff you already use and you update anything regarding that stuff, year, author name e.g. due to wrong spelling, anything, the citation key gets updated according to new style, regardless it is new or old stuff. Yes, that's the consistency I would not like particularly. Regardless, I still think i'll find this addon very useful. Thanks.
    – Celdor
    Nov 4, 2017 at 15:14
  • (IOW this is not likely to change - if you need the keys to change whenever the pattern changes, the way you were editing the existing translator is the best approach)
    – retorquere
    Nov 4, 2017 at 15:16
2

OK. I hope my workaround qualifies to be an answer.

I have fiddled a little bit with Zotero and I found out we can provide our own translators. They are written in JavaScript which I know a little. Because I cannot make my own Export Translator, I have changed the one that already exists: BibTeX by Simon Kornblith, Richard Karnesky and Emiliano heyns, v. 2.1.9 when I type this.

In BiBteX.js which handles exporting to *.bib, there is a following line:

var citeKeyFormat = "%a_%t_%y";

which is a placeholder for the citation key, in this format smith_firstword_2017. I changed the line to the following one:

var citeKeyFormat = "ref:%a%y";

which exports citationkey to something like ref:smith2017.

There is a function buildCiteKey (item,citekeys) which checks for duplicates and adds a suffix like -1, -2, etc. to the citation key. The result is following:

smith_firstword_2017
smith_firstword_2017-1
smith_firstword_2017-2
...

I did not like it, either. I decided to convert numbers the original script generates into a sequence of letters, e.g. a, b, ..., z, aa, ab, ... az etc. I found a code which does it for me here (beware the code under the ink generates error because of a comment line - # should be changed to //):

function convertToNumberingScheme(number) {
  var baseChar = ("a").charCodeAt(0);
  letters  = "";
  do {
    number -= 1;
    letters = String.fromCharCode(baseChar + (number % 26)) + letters;
    number = (number / 26) >> 0;
  } while(number > 0);

  return letters;
}

I inserted the function right after JSON sequence (the very top of the script) and changed the line:

citekey = basekey + "-" + i;

into

citekey = basekey + convertToNumberingScheme(i);

Now, the script generates cite keys according to my format:

smith2017
smith2017a
smith2017b
...
smith2017aa

Hope this answer can help others to make their own formats. I guess some people would prefer to keep the first word of titles. I think then one needs to keep %t placeholder in the variable: citeKeyFormat.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.