retorquere / zotero-better-bibtex

Make Zotero effective for us LaTeX holdouts
https://retorque.re/zotero-better-bibtex/
MIT License
5.25k stars 288 forks source link

Edit Postscript via the preferences. #473

Closed ajustine closed 8 years ago

ajustine commented 8 years ago

Hi,

Thank you very much for this BetterBibTeX tool, it has been very helpful to me. I found out here how to add specific fields in my BibTeX file using the Extra field of each of my references, but I was wondering if it was possible to add those specific fields in every references of an export. It seems possible, but I never wrote JavaScript, and English is not my mother tongue so I have difficulties understanding your tutorial.

What I would like to do is

Am I even clear ? I hope I am. Thank you very much for your help !

Justine

retorquere commented 8 years ago

No worries, this is not the most intuitive part of BBT. The following should work:

this.add({ name: 'x-audience', value: 'international' });
this.add({ name: 'x-popularlevel', value: 'no' });
this.add({ name: 'x-peereviewing', value: 'yes' });
this.add({ name: 'x-proceedings', value: 'yes' });
this.add({ name: 'x-invitedcommunication', value: 'yes' });
if (this.has.language) {
  this.has.language.name = 'x-language';
}
if (this.item.itemType = 'report' && this.has.type) {
  this.has.type.name = 'x-reporttype';
}
retorquere commented 8 years ago

(previous comment updated -- I missed two fields)

ajustine commented 8 years ago

Thank you very much !! Unfortunately, I cannot access the about:config part of my Firefox, for safety reasons sigh Is there a place inside the JS code where I can paste this, and then replace the BibTeX.js file directly in the Zotero translators folder ?

Thank you again, Justine

retorquere commented 8 years ago

I'll add the screen, but how come you can install XPIs, but not access about:config? That seems a little confused, security-wise.

Replacing the translator file won't help as they're replaced by BBT at every start.

retorquere commented 8 years ago

You can try https://github.com/retorquere/zotero-better-bibtex/releases/download/builds/zotero-better-bibtex-1.6.43-circle-2119.xpi

retorquere commented 8 years ago

It's in the "Advanced" part of the prefs

retorquere commented 8 years ago

part of the next release

ajustine commented 8 years ago

Hi, Thank you very much but it still doesn't work (I have a about:config button in the Advanced part of the Prefs but I still get an error message). I asked the IT department of my institution to do it for me and will keep you updated. Thank you again, Justine

retorquere commented 8 years ago

No, I mean if you install that build, you can go into the Advanced prefs of Better BibTeX. There's a text box where you can paste your postscript.

ajustine commented 8 years ago

IT WORKS \o/ Thank you so much !

I only got one problem left : the field "type" is renamed "reporttype" for every document type that contains a "type" field (e.g. phdthesis, misc and unpublished), and I only need it for techreport and manual...

retorquere commented 8 years ago

My bad -- that last = should have been an ==

this.add({ name: 'x-audience', value: 'international' });
this.add({ name: 'x-popularlevel', value: 'no' });
this.add({ name: 'x-peereviewing', value: 'yes' });
this.add({ name: 'x-proceedings', value: 'yes' });
this.add({ name: 'x-invitedcommunication', value: 'yes' });
if (this.has.language) {
  this.has.language.name = 'x-language';
}
if (this.item.itemType == 'report' && this.has.type) {
  this.has.type.name = 'x-reporttype';
}
ajustine commented 8 years ago

Awesome !!! Can I take advantage of your kindness one last time ? How can I set the code if I only want the "x-peerreviewing" field to appear for a certain type of document (let's say, only for articles) ? Many thanks, Justine

retorquere commented 8 years ago
this.add({ name: 'x-audience', value: 'international' });
this.add({ name: 'x-popularlevel', value: 'no' });
if (this.item.itemType == 'journalArticle') {
  this.add({ name: 'x-peereviewing', value: 'yes' });
}
this.add({ name: 'x-proceedings', value: 'yes' });
this.add({ name: 'x-invitedcommunication', value: 'yes' });
if (this.has.language) {
  this.has.language.name = 'x-language';
}
if (this.item.itemType == 'report' && this.has.type) {
  this.has.type.name = 'x-reporttype';
}
retorquere commented 8 years ago

(BTW, I wouldn't encourage you to raise the issue with IT, but their security policy is beyond flawed. It would take me all of 60 minutes to whip up an extension that replicates the about:config screen)

retorquere commented 8 years ago

In the next release (due in a day or so, but it's not in the release you have) you will be able to do the shorter

this.add({ 'x-audience': 'international' });
this.add({ 'x-popularlevel': 'no' });
if (this.item.itemType == 'journalArticle') {
  this.add({ 'x-peereviewing': 'yes' });
}
this.add({ 'x-proceedings': 'yes' });
this.add({ 'x-invitedcommunication': 'yes' });
if (this.has.language) {
  this.has.language.name = 'x-language';
}
if (this.item.itemType == 'report' && this.has.type) {
  this.has.type.name = 'x-reporttype';
}
ajustine commented 8 years ago

Yaaaay ! Thank you soooo much ! And, well, I won't raise the issue with IT... Many thanks again !

retorquere commented 8 years ago

My pleasure.