Word: Possibility to link references and bibliography in a document?

After searching through the forums I couldn't find a related topic, so I'll create a new discussion. If anyone knows where to find the answer, feel free to point me there.
Actually, I wonder why this does not show up anywhere as I think it would be a rather important feature of the Zotero Word plugin.

My problem:
I'd like to have the in-text Zotero references in a Word document, e.g. [1] in IEEE style, to be linked and clickable (within the Word document) so that Word jumps to the appropriate entry in the bibliography (which was created by Zotero at the end of the document), e.g. [1] John Doe et al., "Title of the paper"...
I imagine it the same way you can click on an entry in the outline of a document and Word jumps to the linked section.

I would have expected that this behavior of references is already included in the Word plugin. Obviously, it isn't, at least not for me.

Moreover, this would be very helpful when exporting documents to PDF, as the links within a Word document can be included in the exported file, so that the PDF would contain the same links.

Thanks for your comments on this issue!
«13
  • this is not currently possible - I think it has been mentioned a couple of times, but I'm not even sure if a developer ever chimed in.
    My understanding is that it's at least not trivial to do in the plugin.
  • Thanks for your quick response! At least now I know that it's not included in the plugin.

    The only workaround I've figured out so far, is to remove the Zotero code from the Word document, i.e. convert the Zotero references into plain text, then add (Word-)bookmarks to the bibliography and link every single reference in the text manually.
    In practice, however, even for a few references, that's too tedious to do.

    Does anyone know any better workarounds?
  • This post is 2 years old so maybe there's has been something new about it ? I've been asked the same question yesterday. I understand adamsmith answer that it's not easy but maybe someone did something ...
  • This has not been implemented. What is the prroblem that you are trying to solve by linking the reference from text to the bibliography? You can inspect the full reference by editing the citation.
  • @mronkko2 it's not really in Word that this function would be interesting, but when generating a PDF. When seeing a ref in text : (AUTHOR 2010) in iso-690 for example, being able to jump to the reference at the bibliography at the end of the document.

    There's the problem to come back to the (AUTHOR 2010), in particular when there are multiple pages where the item is used, I don"t know how it could be done, but being able to go to end of document could be fine to start.
  • I read a pdf report that handled the bib ref to text locations well. I wish that I saved the document but I did not. Clicking on the bib entry produced a popup listing of all the places where the reference was cited in the body of the document. There was a mouseover effect that displayed several words before and after the in-text reference. I was very impressed with this (I was not impressed with the content of the report) and intended to discover how the reference linking was accomplished. I don't remember the name of the document, only that it was published by a transportation or fire safety agency or NGO in Europe.

    I know that this comment isn't very helpful but it showed that this 2-way linking is possible in a pdf document.
  • I agree with symac that in-document linking would be neat. Two way linking is better, but one way linking is nice enough by itself.
    I think from the Zotero side, the question is if RTF even supports it. If it does this would likely be possible, if not, I'm not seeing how that'll happen.
  • edited January 21, 2013
    One way linking should not be too difficult to achieve (adding cross-references in Word)

    I think two way linking (as described by DWL-SDCA) would also be possible in Word, with a bit of work. I don't think that it would be possible to transfer such pop-ups to a PDF document however. You can make all sorts of fancy things in PDFs using software like InDesign, but I'm pretty sure that Word's PDF generator will not support such elaborate features.

    Edit: two other recent threads on this: [1] [2]
  • edited January 26, 2013
    Bump to this thread. I was searching how to do it right now, but apparently it's not possible right now. I know it can be done in LaTeX, of course, and EndNote... but I happened to choose Zotero waaay ago and sticked to it.

    It's an important functionality for thesis, since usually there are lots of references there and it's useful to navigate them with hyperlinks. Looking forward to developers willing to contribute this feature! :D
  • @ajene Does your university allow a pdf-only thesis? If that is the case, it is likely to be taken-up by more universities. That would be incentive for the word processor developers to move toward linking.

    @aurimas In my experience, one-way linking is possible in Word but it doesn't work reliably.Two-way linking is not (yet) possible. In my experience the MS Office pdf converter goes a bit crazy when 1) the document is long (pagination and page breaks can differ between the doc and pdf versions) and 2) any linking in the doc format doesn't transfer to pdf. I quit using MS Word for LO Writer primarily because the LO pdf converter was much more reliable.
  • edited January 27, 2013
    @DWL-SDCA they require only one hard copy of the thesis in my university; the rest may be hard or pdf. Which saves tons of money, and trees ;)

    I really think this should be a functionality in zotero, since many people, AFAIK, use it to write their thesis. Maybe not so important for individual papers, but definitely a must for bigger stuff.

    edit: probably this thread shoouldn't be in the "plugins" section...?
  • Is it possible to hyerlink references to the bibliography using zotero in other word processors? If so does anyone know if you can convert from Word to such a wordprocessor to create the hyperlink functionality?
  • this is generally not possible, no.
  • I am doing a phd thesis and only now realize ( after using zotero for many years) that this ref linking function does not work in teh plugin. I have to have it for my university as they now want a electronic pdf and they expect this type of linking in the pdf. Also, with a large thesis I need it too - it would be hell without it checking that all works. So what to do. I guess I can still use zotero ( all my stuff is in it) and export everything from zotero to word ref systems or endnote ( what a pain). Trouble is, I still am putting new refs in - so I would have to leave zotero stand alone open, find the new refs, then do an export every time. Seems that would slow me down. Any suggestions would be appreciated.
  • edited March 2, 2013
    is working with LaTeX or LyX an option? Those integrate pretty well with Zotero and do have templates that link citations and bibliography.
  • No - too invested in Word at this point. Researching: zotero, export whole bib into Word bib, then round tripping new zotero's bib I get right then and there over on the fly. I will see how slow and complicated that is, else will have to move my zotero stuff to endnote or something else that works with ref two way linking in word/pdf at least till thesis is done.
  • Note that EndNote does not offer two way linking (at least I can't find any way to add it). I don't know if any citation managers offer this functionality.

    One way linking in EndNote is possible though (from the citation in text to the bibliography) and it caries over to the exported PDF.
  • LaTeX can do two way linking, adding the page number of the different citations as links behind the bib entries. I'm not sure if everyone would be happy with that, but it's very elegant I think.
    See here for an example
    http://scholar.harvard.edu/files/msen/files/sen_ratings.pdf
  • (cross-referencing in Word and LO is done via bookmarks which are not just stable between the two but also in RTF, so technically this should be doable).
  • well after 4 hours of research, MS Word just does not seem to do two way linking anyway - it is laTeX that does. I tried so many tools ) about 20), and finallu got a zotero exported to bibtxt -> jabref exported to word 2007 xml -> then a fix (add a tag) to word 2010 -> then in word === only to find out no linking in word, and no linking in pdf converted from word. So i'll increment 4 more hours wasted on MS office crap added 100s in my lifetime and I am back with Zotero. I realize that many of finished thesis I was looking at was from a laTeX template, that my supervisor prbably wants me to use. I double checked: refworks, mendelev and other word plugins do not do two way linking in word as well. Would be a nice postprocess macro or zotero plugin extra one day. Ok back to the content of my thesis - teaching a computer to paint portraits ( dipaola.org/rembrandt).
  • edited March 4, 2013
    I have written a Word Macro, that links Author-Date or Number Style Citations to their Bibliography entry based on the title.

    It searches the Field for a number (either a year or a sequential number), selects it and then links it to the title that is in the zotero field. The zotero fields shouldn't get harmed. Multiple citations should work too.

    Unfortunately, Superscript Styles are not supported yet, as selecting the number would result in the whole field to be replaced with the link. I don't know how one could change the resulting text of the field, because then one could add hidden text to it.

    (Hidden Text could also be placed into or after the field for having a clickable "edit citation" button.)

    Feedback or improvements are welcome! The code is in the public domain.
    Public Sub ZoteroLinkCitation()
    Dim nStart&, nEnd&
    nStart = Selection.Start
    nEnd = Selection.End
    Application.ScreenUpdating = False
    Dim title As String
    Dim titleAnchor As String
    Dim style As String
    Dim fieldCode As String
    Dim numOrYear As String
    Dim pos&, n1&, n2&
    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
    fieldCode = aField.Code
    pos = 0
    Do While InStr(fieldCode, """title"":""") > 0
    n1 = InStr(fieldCode, """title"":""") + Len("""title"":""")
    n2 = InStr(Mid(fieldCode, n1, Len(fieldCode) - n1), """,""") - 1 + n1

    title = Mid(fieldCode, n1, n2 - n1)

    titleAnchor = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(title, " ", "_"), "&", "_"), ":", "_"), ",", "_"), "-", "_"), ".", "_"), "(", "_"), ")", "_"), "?", "_"), "!", "_")
    titleAnchor = Left(titleAnchor, 40)

    Selection.GoTo What:=wdGoToBookmark, Name:="Literature"
    Selection.Find.ClearFormatting
    With Selection.Find
    .Text = Left(title, 255)
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindAsk
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    Selection.Find.Execute

    Selection.Paragraphs(1).Range.Select

    With ActiveDocument.Bookmarks
    .Add Range:=Selection.Range, Name:=titleAnchor
    .DefaultSorting = wdSortByName
    .ShowHidden = True
    End With

    aField.Select

    Selection.Find.ClearFormatting
    With Selection.Find
    .Text = "^#"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With

    Selection.Find.Execute

    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdCharacter, Count:=pos

    Selection.Find.Execute
    Selection.MoveLeft Unit:=wdCharacter, Count:=1

    Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend

    numOrYear = Selection.Range.Text & ""

    pos = Len(numOrYear)

    style = Selection.style

    ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="", SubAddress:=titleAnchor, ScreenTip:="", TextToDisplay:="" & numOrYear
    aField.Select

    Selection.style = style
    'Selection.style = ActiveDocument.Styles("CitationFormating")
    fieldCode = Mid(fieldCode, n2 + 1, Len(fieldCode) - n2 - 1)

    Loop
    End If
    Next aField
    ActiveDocument.Range(nStart, nEnd).Select
    End Sub
  • Btw, to set a style for the resulting link uncomment the line
    'Selection.style = ActiveDocument.Styles("CitationFormating")
    and write your style there.

    You can use it in combination with my other macro for styling the citations: http://forums.zotero.org/discussion/16540/exempt-zotero-fields-from-being-spellchecked-word-2010/#Comment_148244
  • And btw, when i export to PDF from Word 2007, hyperlinks just work fine.
  • Tryed to run your macro on my thesis, I am new to this , so I might have any number of things wrong but I get the error

    Bookmark does not exists and debugging that, it happens on this line:

    Selection.GoTo What:=wdGoToBookmark, Name:="Literature"

    Any help is appreciated.
  • Oh, sorry. Typical programmers blindness:

    You can manually create a bookmark that selects the zoteto bibliography field and call it literatue. It should work then.

    Ill soon update this so that it looks for the field itself.

    My next plan is backreferencing with (1a) and (1b) in the text and a:pagenumber, b:pagenumber in the bibliography. I dont know yet how to handle this with author-date, but ill probably use roman numerals (as year+letter is already used as disambiguation.
  • So here is the update. please tell me if it works now :)

    Public Sub ZoteroLinkCitation()
    Dim nStart&, nEnd&
    nStart = Selection.Start
    nEnd = Selection.End
    Application.ScreenUpdating = False
    Dim title As String
    Dim titleAnchor As String
    Dim style As String
    Dim fieldCode As String
    Dim numOrYear As String
    Dim pos&, n1&, n2&

    ActiveWindow.View.ShowFieldCodes = True
    Selection.Find.ClearFormatting
    With Selection.Find
    .Text = "^d ADDIN ZOTERO_BIBL"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    With ActiveDocument.Bookmarks
    .Add Range:=Selection.Range, Name:="Zotero_Bibliography"
    .DefaultSorting = wdSortByName
    .ShowHidden = True
    End With
    ActiveWindow.View.ShowFieldCodes = False

    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
    fieldCode = aField.Code
    pos = 0
    Do While InStr(fieldCode, """title"":""") > 0
    n1 = InStr(fieldCode, """title"":""") + Len("""title"":""")
    n2 = InStr(Mid(fieldCode, n1, Len(fieldCode) - n1), """,""") - 1 + n1

    title = Mid(fieldCode, n1, n2 - n1)

    titleAnchor = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(title, " ", "_"), "&", "_"), ":", "_"), ",", "_"), "-", "_"), ".", "_"), "(", "_"), ")", "_"), "?", "_"), "!", "_")
    titleAnchor = Left(titleAnchor, 40)

    Selection.GoTo What:=wdGoToBookmark, Name:="Zotero_Bibliography"
    Selection.Find.ClearFormatting
    With Selection.Find
    .Text = Left(title, 255)
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindAsk
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    Selection.Find.Execute

    Selection.Paragraphs(1).Range.Select

    With ActiveDocument.Bookmarks
    .Add Range:=Selection.Range, Name:=titleAnchor
    .DefaultSorting = wdSortByName
    .ShowHidden = True
    End With

    aField.Select

    Selection.Find.ClearFormatting
    With Selection.Find
    .Text = "^#"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With

    Selection.Find.Execute

    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdCharacter, Count:=pos

    Selection.Find.Execute
    Selection.MoveLeft Unit:=wdCharacter, Count:=1

    Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend

    numOrYear = Selection.Range.Text & ""

    pos = Len(numOrYear)

    style = Selection.style

    ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="", SubAddress:=titleAnchor, ScreenTip:="", TextToDisplay:="" & numOrYear
    aField.Select

    Selection.style = style
    'Selection.style = ActiveDocument.Styles("CitationFormating")

    fieldCode = Mid(fieldCode, n2 + 1, Len(fieldCode) - n2 - 1)

    Loop
    End If
    Next aField
    ActiveDocument.Range(nStart, nEnd).Select
    End Sub
  • Many thanks for your macro!

    But I still have some problems by using this nice macro.
    Some References were linked and some (the most of them :-( ) were not linked with the bibliography.
    Another problem is given by runtime error 5828.



    Line:
    .Add Range:=Selection.Range, Name:=titleAnchor


    Thank you very much indeed!
  • I try to start the macro again.

    I have replaced
    .Add Range:=Selection.Range, Name:=titleAnchor by
    .Add Range:=Selection.Range, Name:="Zotero_Bibliography"


    (line 67)

    Now it works more convenient!
    But one problem is already existing, only the first two items in a bracket were linked.

    I am just new in that topic, I did not really understand what happens.

    So thanks for your comments.
  • Any updates are appreciated - this macro is a great addition.
  • I'd just like to give a +1 for at least one-way linking integrated to Word plugin. I think it can be done totally independent from Zotero, just on the Word side. Maybe something based on antikorpo's solution, if it would be just a single button on the toolbar / checkbox in the settings, it would be amazing!
Sign In or Register to comment.