Extract annotations in APA with Zotfile

I found an old thread discussing this via https://forums.zotero.org/discussion/72398/how-to-extract-annotation-in-zotfile-with-apa-format

But it didn't quite solve the issue...

Right now, the extracted annotations' default format is MLA. Hence, (Garret 2004:57).

Is there a configuration for APA? Hence, (Garret, 2004, p. 57) for extracted annotations?

The above thread mentions playing with the Config Editorfor these preferences:
extensions.zotfile.pdfExtraction.formatAnnotationHighlight
extensions.zotfile.pdfExtraction.formatAnnotationNote
extensions.zotfile.pdfExtraction.formatAnnotationUnderline
extensions.zotfile.pdfExtraction.formatNoteTitle
extensions.zotfile.pdfExtraction.formatNoteTitleColor

But none of these changes the extract format. Any thoughts? Thanks!
  • edited March 2, 2020
    Update: I've been browsing and found this APA
    "patch", see the last comment: https://github.com/jlegewie/zotfile/issues/175

    I installed the APA one in my Zotero add-on...and then zotfile stops extracting annotations!! And it looks like this "patch" just merged with the original Zotfile so I cannot find an individual entry on my add-on list to uninstall it.

    It totally messed up my zotfile....the preference pane looks distorted. I'm nor re-installing zotfile. Just so everyone knows, DO NOT install the APA patch in the above link.
  • edited March 3, 2020
    Thanks @biubiubiubunny for highlighting how not to use my Zotfile APA tweak.

    I last edited that post over 2 years ago and provided customised versions of Zotfile for the (then current) version 5.0.6.

    For anyone who wants to create a customised version of Zotfile to gather extracts using APA format in-text citations, the code and guidelines in my post still work. I have just tested this with Zotfile version 5.0.16 - although the line to replace in pdfAnnotations.js is now 226.

    I recommend you uninstall Zotfile and before installing the current version of Zotfile with the APA tweak applied. You will also need to set "Automatic Updates" to "off" if you don't want this overwritten by the next version of Zotfile - which you will need to tweak as per my post and update manually in order to stay current. It would obviously be ideal if this option were built into Zotfile to save the trouble of manual editing and installation for each new Zotfile version.



  • edited March 4, 2020
    Oh wow, I didn't expect the author from that post would be able to see and respond to my quesiton.

    Thank you for the update, @gsummers And if you don't mind, I wonder if you could help look into which step I have done wrong? I tried to change the cite = line but failed to install the changed add-on.

    1. I don't know much about programming so I simply downloaded zotfile-5.0.16-fx.xpi and changed the extension to .zip to find pdfAnnotations.js

    2. I de-compressed .zip and went to zotfile-5.0.16-fx/chrome/content/zotfile/ to find pdfAnnotations.js

    3. I opened pdfAnnotations.js using Mac's default text editor (TextEdit). I searched for the cite = line. However, I cannot find the line @gsummers cited in the github post. It might have changed due to that I'm working with the current Zotfile version. This line now appears to be: cite = this.getPref("pdfExtraction.NoteFullCite") ? this.Wildcards.replaceWildcard(item, "%a %y:").replace(/_(?!.*_)/," and ").replace(/_/g,", ") : "p. ",

    4. I replaced this line using the line provided for APA format in that github post:
    cite = this.getPref("pdfExtraction.NoteFullCite") ? (str_title += " APA FullCite ", this.Wildcards.replaceWildcard(item, "%a, %y").replace(/_(?!.*_)/," & ").replace(/_/g,", ") + ", p. ") : (str_title += " APA PageCite ","p. "),

    5. I saved pdfAnnotations.js, compressed the folder zotfile-5.0.16-fx, and changed the extention of this .zip back to .xpi

    6. I uninstalled the original Zotfile from Zotero. I then tried to install the .xpi I just saved and however failed....

    This is the message I received:
    Add-on Installation Failed.
    The add-on "%S" could not be installed. It may be incompatible with this version of Zotero.

    I assume there is something wrong with what I did. Anybody could help?



    **A note for my first failure of attempting to customize APA.
    My situation is that I didn't change anything with pdfAnnotations.js but installed the .zip attached in the github thread. Like I said, I know almost nothing about programming so I chose the easy way... And my Zotfile stopped working altogether. I reinstalled Zotfile and things are ok again. I freaked out because I customized many congifutations to make Zotfile work better with my habits. I am glad and also surprised to see that reinstalling Zotfile didn't erase the little configurations I have made over the years which I probably don't remember how to re-do...
  • Hi @biubiubiubunny

    In general, your workflow looks good. In step 5 you may have compressed the whole "zotfile-5.0.16-fx" folder instead of just the contents of the folder. This would cause the error in step 6.

    Does that solve the problem?
  • Hi @gsummers

    I successfully installed the add-on. However, in my extracted annotations, only the notes I write in the pdfs have the page number in APA; regular highlights are still the same.

    For example (The second paragraph is a sticker note I wrote with regard to the first paragraph):

    "The Vapors opened their pop hit "Turning Japanese" (1980) with an electric version of this riff, and their novelty song continues to mark Asian difference in recent film soundtracks, including Charlie's Angels(2000) and Not Another Teen Movie(2001)." (Garret 2004:131)

    For the importance of researching “old” musical examples. (note on p.131)

    Any thoughts? Thank you for the help!!
  • Hi @biubiubiubunny

    You are describing the default Zotfile output which indicates that you have re-installed the original version and not your APA modified version.

    I have now added the APA version of Zotfile 5.0.16 to the github thread you initially referenced. See end of:
    https://github.com/jlegewie/zotfile/issues/175
  • @gsummers I checked again and you are right! I accidentally reinstalled the original one. Totally my B. I have too many copies stored on my computer. I tried the original approach (changing pdfAnnotations.js) and it worked!

    This saves me so much time in writing papers. Really appreciate the help!
Sign In or Register to comment.