Shared Documents - Where Does the Word Plugin Get its References?

Hi!

One of my grad students is using Zotero and we're working on a Word document together (PC). The Word document already has references. I'm running the Windows app while Word is open.

The student sent me an RDF file. I imported that as a new private group library.

However, the Word document seems to be using its own internal library. None of the changes I make to the new group library (capitalization, spelling, etc.) are reflected in the Word document.

Moreover, there are references showing up in the Word document that were not present in the library I received. Somehow, those references are updated, even when cutting/pasting.

Clearly there's disconnect between the app and the library I created (not to mention a disconnect in my understanding of how Zotero works).

I'm used to EndNote, where the active library window (or collection of open libraries) determines what "reference" pool Word uses when formatting the citations and bibliography.

How can I re-establish the connection with the new library I created? The library I received is a mess, with lots of problems in capitalization, abbreviation, and title formatting.

Thanks,
Nick
  • The best way to jointly work on a document -- and the only way that allows everyone to edit not just the document but also the underlying metadata -- is to use Zotero groups.

    If you cite in a document and then send it to someone else without access to the library from which items were cited, Zotero falls back to metadata embedded in the document at the time of citation. There is no way the recipient can edit the metadata. The RDF export creates completely new items with no connection to the document on import, so that doesn't help.

    The only way to fix the references is either for you to re-insert the items in the document or for your collaborator to fix them (unless they were cited from a group, in which case they can invite you to the group and you can fix them there).
  • Thanks! I appreciate the response.

    On the other hand, this is really bad news. If everything is linked to a group, what if the student graduates or gets rid of their account? What if I start a new document from my personal library but want to add collaborators later on?

    Cloud computing can be very convenient, but surely someone on the dev team must realize how problematic this is. For me, it's probably a deal breaker.

    Nick
  • The student graduating or getting rid of their account doesn't affect the group, so that part is unproblematic. The other scenario is indeed not ideal -- I think devs are thinking about improvements around that. In most cases having the original co-author just fix the references works fine -- I co-author a lot, it's never been an issue.
  • What if I start a new document from my personal library but want to add collaborators later on?
    Yes, this one is not ideal, and we're currently working on making it possible to relink citations in a document to items from another library. But it's a very hard problem.

    Just to clarify your example, @nfitzkee, think about it this way:

    1) The student creates citations from their personal library.
    2) They export the items to RDF, and then you import into your own library.
    3) You make lots of corrections to those items in Zotero.

    If those items you imported somehow automatically updated the citations in the document when you refreshed, then if the student refreshed the document with their own now-outdated versions of the items, the citations would change back, and that would happen every time one of you refreshed the document. It would be totally unusable. So there's no way this would work via export/import.

    What we do hope to make possible is exactly what you describe — starting in a personal library and then being able to transfer items to a group library and relink the document to the items in the group library so everyone can edit them. We may also make it possible to transfer embedded items back to Zotero and relink to those, which would help in the case where you have a document created with Zotero but the person who created it is no longer around. But one way or another, items have to be linked to a given library so that there's an authoritative source for the metadata.

    But for now, as adamsmith says, the best option when you didn't start in a group library is just to let the person who originally added the citations edit the metadata in Zotero as necessary.
  • (I mean, I guess there's a world where exporting/importing preserved unique global identifiers for items, and you could tell Zotero to look for those identifiers in a given library and use those to relink the citations to the imported items. But that's not how export/import currently works, and it would introduce new problems — e.g., if you imported the same item multiple times, it would have to deal with deduplication. The most reliable way to do this will be to use the links Zotero already maintains when you transfer items between libraries to let you relink the items.)
  • This is not a full solution to this problem but it is a partial one. Once you have all the citations from a document in a folder in a group library, you can insert a "Multiple Sources" citation to the entire folder at the end of the document and then run the macro below. This will match based on DOI, URL, and title to try to replace the URIs in the document with those from the last matching citation in the document, which is hopefully the one from the group library. Replace the group number with yours to check for items that didn't work... This should be relatively customizable. It's based on some other macros that were posted in another thread that I cannot find right now.

    Public Sub ZoteroFixUris()
        ' define variables
        Dim fieldCode As String, UriStr As String, TitleStr As String
        Dim n1 As Long, n2 As Long, n3 As Long, i As Integer, k As Integer
       
        Const UriStrBeg As String = """uris"":["
        Const UriStrEnd As String = "]"
        Const IdStr As String = "{""id"":"
        Const ItemIdStr As String = """itemData"":{""id"":"
        Const ItemStr As String = """itemData"":"
       
        Dim Uris, Finals
        Set Uris = CreateObject("Scripting.Dictionary")
        Set Finals = CreateObject("Scripting.Dictionary")
       
        Dim BegStrs As Variant
        BegStrs = Array("""DOI"":""", """URL"":""", """title"":""")

        For k = LBound(BegStrs) To UBound(BegStrs)
            Uris.RemoveAll
            Finals.RemoveAll
           
            ' loop through each field in the document
            For Each aField In ActiveDocument.Fields
                ' check if the field is a Zotero in-text reference
                If InStr(aField.code, "ADDIN ZOTERO_ITEM") > 0 Then
                    ' Get the JSON from the field and cut off the initial stuff
                    fieldCode = aField.code.Text
                    If InStr(fieldCode, "Rice Wastes for Green Production") Then
                        fieldCode = fieldCode
                    End If
                    n1 = InStr(fieldCode, """citationItems"":")
                    fieldCode = Mid(fieldCode, n1, Len(fieldCode) - n1)
                   
                    ' Loop through all the citation ids
                    Do While InStr(fieldCode, IdStr) > 0
                        n1 = InStr(fieldCode, IdStr) + Len(IdStr)
                        fieldCode = Mid(fieldCode, n1, Len(fieldCode) - n1)
                   
                        ' Grab the contents of the uris array
                        n1 = InStr(fieldCode, UriStrBeg) + Len(UriStrBeg)
                        n2 = InStr(Mid(fieldCode, n1, Len(fieldCode) - n1), UriStrEnd) - 1 + n1
                        UriStr = Mid$(fieldCode, n1 - 1, n2 - n1 + 2)
                       
                        'Skip the second id field in itemData
                        n1 = InStr(fieldCode, ItemIdStr)
                        n2 = InStr(fieldCode, ItemStr)
                        If n1 > 0 And n1 <= n2 Then
                            n1 = n1 + Len(ItemIdStr)
                        Else
                            n1 = n2 + Len(ItemStr)
                        End If
                        fieldCode = Mid(fieldCode, n1, Len(fieldCode) - n1)
                       
                        n1 = InStr(fieldCode, BegStrs(k))
                        n3 = InStr(fieldCode, ItemStr)
                        If n1 > 0 And (n1 < n3 Or n3 = 0) Then
                            ' Grab the title
                            n1 = n1 + Len(BegStrs(k))
                            n2 = InStr(Mid(fieldCode, n1, Len(fieldCode) - n1), """,""") - 1 + n1
                            If n2 < n1 Then 'Exception if title is last field
                                n2 = InStr(Mid(fieldCode, n1, Len(fieldCode) - n1), "}") - 1 + n1 - 1
                            End If
                            If (n2 < n3 Or n3 = 0) Then
                                TitleStr = LCase(Mid(fieldCode, n1, n2 - n1))
                                TitleStr = Replace(TitleStr, "http://www.", "")
                                TitleStr = Replace(TitleStr, "https://www.", "")
                                TitleStr = Replace(TitleStr, "http://", "")
                                TitleStr = Replace(TitleStr, "https://", "")
                                TitleStr = Replace(TitleStr, "doi.org/", "")
                               
                                ' Add these to the collections
                                If Not Uris.Exists(UriStr) Then
                                    Uris.Add Key:=UriStr, Item:=TitleStr
                                    If Finals.Exists(TitleStr) Then
                                        Finals.Remove TitleStr
                                    End If
                                    Finals.Add Key:=TitleStr, Item:=UriStr
                                End If
                            End If
                        End If
                    Loop
                End If
            Next aField
            Dim keys, changed As Boolean
            keys = Uris.keys
            ' Just do all the URIs in all the fields
            For i = LBound(keys) To UBound(keys)
                TitleStr = Uris(keys(i))
                UriStr = Finals(TitleStr)
                If InStr(UriStr, "http://zotero.org/groups/0000000/items/") = 0 Then
                    MsgBox TitleStr & " still has Uri " & UriStr
                End If
            Next i
            For Each aField In ActiveDocument.Fields
                If InStr(aField.code, "ADDIN ZOTERO_ITEM") > 0 Then
                    fieldCode = aField.code.Text
                    changed = False
                    ' Just do all the URIs in all the fields
                    For i = LBound(keys) To UBound(keys)
                        TitleStr = Uris(keys(i))
                        UriStr = Finals(TitleStr)
                        If InStr(fieldCode, keys(i)) > 0 And keys(i) <> UriStr Then
                            fieldCode = Replace(fieldCode, keys(i), UriStr)
                            changed = True
                        End If
                    Next i
                    If changed Then
                        aField.code.Text = fieldCode
                    End If
                End If
            Next aField
        Next k
    End Sub

  • I'm having a very similar issue, on the student side. I'm working with an editor to format and correct my footnotes for my dissertation. Although the footnotes are all still linked, some citations in the document are linked to my personal library while some are linked to the group library.

    1) I created items in my personal library.
    2) I created a group library with my editor and added all those same items to the group library.
    3) I edited the metadata for the items in the group library (adding language codes, mainly, to override the default English capitalization conventions).
    4) When I refresh the document to update the citations or generate the bibliography, those changes to the metadata are not applied, even though the metadata has been changed in the group library.

    I tried copying the group library back into my personal library with the plan to de-dupe everything in favor of the versions in the group library, and then updating the document again, but that didn't work. (I'm guessing because the items are stored in my personal library and the group functions as a collection--the reason doesn't matter much to me since it didn't work.) Even if it had worked as a stop-gap, this also wouldn't have solved the main issue, since the problem (at least as far as I understand it) is that the citations are split between my personal library and the group library and this is creating issued with the document.

    To further complicate things, there are over 500 footnotes, many of which have prefixes and suffixes, or else many citations in the same note. I'm a historian, so I have to cite manuscripts and archives in a specific way, and the most efficient solution I've found for this is prefixes.

    As far as I can tell, I don't have a way to change where the citations link to (my personal library or the group library) without deleting and re-inserting all of the citations with links to the same items in the group library. Is that right? Is there some other process I can try? I'd love any suggestions.
Sign In or Register to comment.