Link to a Zotero item from its reference in word processor (word/oo plugin feature request)

I wish there was an easier way to pull up my notes on a book/article when writing. Often, when thinking about a particular book/essay, I have a thought that I would like to add to the note attached to the Zotero Item, or I want to read my existing notes on the book.

However, it is very cumbersome to jump from an existing reference in a text document to a Zotero item. You basically have to task-switch to Firefox, open Zotero, run a search, then pick the right entry from the results.

It would be nice if there was a way from jumping from a reference in a Word document right to the Zotero item (quick access to notes and related items!). Here's what I have in mind: put the curson on a Zotero citation in your text document, then hit either a button, context menu or keyboard shortcut to bring up Zotero with the corresponding Zotero Item selected.

Now THAT would be a real timesaver for lots of people IMHO.
  • I think that your request makes a lot of sense.

    Currently you can somewhat do this by using ZoteroQuickLook (
    1) Edit the citation
    2) In the edit dialog, highlight the item you want to view
    3) Press space bar to view the PDF

    Takes a second or two. The downside is that you cannot edit the PDF or the Zotero item this way.
  • This would be really sweet.
  • As a perhaps more low-tech solution it would already help a lot if notes could be read and modified in the plugin.
    The fact that you can't even read them is really unfortunate.
  • edited July 24, 2010
    mronkko, thanks for the link to the quicklook plugin! I'm on a mac, so it works right out of the box. It doesn't really do what I need (easy access to my attached reading notes), but at least I can pull up the PDF file.

    Note for those interested in the plugin: it only works for attached, but not for linked PDF files.
  • Hi,
    is there a roadmap for this feature?

    Especially if you are working within a group this is a basic necessity - if a new reference is added there is no direct way for the others to have a look on the entry???
    Also, even working alone: When citing a reference in a text I quite often have the need to change/add a keyword, a note...
  • there's no timetable, no.
  • Uuuh,
    that´s bad.
    That is a knockout criterium.
    We are planning to work on guidelines, there is a need for discussion and the citations need to be evaluated, so an easy access to the entries (and to the original, but editable text) is badly needed.
  • I totally agree. This feature is an absolute must!
  • this won't do quite what people want, but note that the quicklook plugin referenced above can now access notes in the word processor plugin.
  • In case anyone with an itch to see this functionality implemented has Javascript skills, it could be provided by a small companion Firefox plugin. As the documentation of Zotero's internals improves, I hope that we will see more small addons contributed to cover this and other usability requests. The Zotero UI needn't be treated as a centrally administered monolith; a rich stable of small extensions would ease pressure on core development, and give greater flexibility across the range of tasks that Zotero is turned to out in the field.
  • Well, this kind of requires a button in the word processor, no? Otherwise you'd need to awkwardly go through the Edit Citation window. So this might be a bit more complicated than a companion Firefox plugin.

    I don't really have a comment on whether we'd add a button for this, but it's worth discussing.
  • True, the interface of a plugin may be more awkward than desired, but if the code for navigating to the target item can be built and tested without touching the Zotero and plugin internals, that would be a step forward, and adopting the code and tying it into a more elegant interface could follow. That's the thought, anyway.
  • edited May 13, 2011
    The code to select the item in Zotero would be approximately one line. It'd actually be more complicated to do it in a plugin, since you wouldn't be in the main window.

    Really the only question here is if it's worth space in the word processor.
  • I vote for yes it's worth it - I think context menu would be even better, but I'd guess that's harder/not possible for word processor plugins?
  • Apparently you can add contex menu items from VBA, so for instance when you right click on a citation field right now you get the "edit field" etc options, but a 'Zotero view notes" entry could be added by the word plugin.
  • I think this would be pretty useful too. A contextual menu would be a nice compromise space-wise. Otherwise, is it possible to have Zotero expose optional buttons, so people can enable such a button in LO/OO?
  • edited June 30, 2011
    This feature is *almost* there already - if you put the cursor in your word document in the citation field and click on the "Zotero Edit Citation" button then the "Add/Edit Citation" dialog pops up with the current reference highlighted.

    How about make r-click in the Add/Edit Citation dialog (currently does nothing) to open the main zotero window with that same reference selected. - or even better make the r-click in the edit Add/Edit Citation dialog bring up a small context menu with options such as "view, info, notes, tags, related" that opens the respective view in zotero.

    This might be easier to implement as the context menu is in the zotero code (as opposed to making the rclick context menu inside Word.)
  • The latest development version of ZoteroQuickLook allows you to view attachements and notes directly from the word processor using QuickLook. See the last post in this tread for details.
  • edited September 28, 2011
    Adding this functionality would help me more than anything else I've seen on a wishlist and Grubs is right, we're almost there! The Cntrl+Alt+E option provides easy access to pdf names (apparently not the actual pdfs), but doesn't bring up the interface which provides the all important access to the notes and the underlying citation data (which often needs to be manually edited to make the citation right).

    It seems like it would be so straight forward to add a further word add-in to which a shortcut key could be assigned that I even wanted to give it a bash myself. Only problem is that the existing Zotero add-in macros I wanted to build off (I can do basic macros, but I'm no programmer) are not viewable. That seems a shame for an otherwise FANTASTIC open source project and has stopped me potentially developing something I would happily have shared with everyone.
  • as mronkko says above - Zotero quicklook does allow you to view notes from the word plugin.
    Also, of course the word plugin is open source, it's even on github: (bottom of the screen).
  • They are viewable. You have to open the template file and view them. But looking at the macro files probably won't help, because they are stubs that just send a message to the Zotero Firefox extension, where the code is. See getting started. You are probably interested in quickFormat.js (for new-style add citation dialog) or addCitationDialog.js (for old-style add citation dialog).
  • julianwyatt: You should check out the latest development version of ZoteroQuickLook to see if that answers to your need. There is a demo video here. The quicklook from citations feature is currently mac only because I have not had time to implement it on the windows side. (And I am not terribly familiar with template files either.)

    To get this working on windows, you would only need to write a template file that includes the definition for a new button and corresponding keyboard shortcut. Pressing this button would need to send a message to Zotero. The content would be the same as for editing citations, but instead of editCitation, it would start with quickLook.

    If you can provide this template file, I can write an installer for it and bundle it with ZoteroQuickLook so that it will be available for all Windows users in the next release.
  • Thanks for your quick responses everyone and my apologies for not finding the macros originally and also doubting that Zotero wouldn't be 100% open source and collaborative, which is great!

    Mronkko, well done with QuickLook, but it doesn't meet my needs as I need to not just to see, but to edit the Zotero citation data, notes and associated pdfs. Simon, you're right about the macros not helping me and unfortunately coding a firefox extension is well beyond my modest capabilities.

    In the interest of trying to help out such a great project, however, I did manage to create a very inelegant workaround using a word macro which I might as well share because, to my surprise, it works. I had very little idea what I was doing (am a lawyer, not a programmer), but managed to produce something that seems to work by building off Zotero's 8 character identifiers and how the Gnotero extension seemed to work.

    You need to create a new module in Word to use ShellExecute to open the identifier extracted from the relevant Word footnote's field code in a blank new tab in firefox which also selects the relevant item in Zotero in the AppTab. It's a bit clumsy, because you need to click Ctrl+Alt+Z once in firefox at the end.

    I have never made a macro for other people before and am sure it is very ugly for all your programming types, but will try to post it in my next comment and then you can go to town on it! It will undoubtedly have problems, but currently works for me (on Windows 7, with Zotero 3 for Firefox always open as an AppTab in Firefox 7). Coming next post, hope it helps some people / gets the ball rolling.
  • it's probably better to post the code somewhere else - the forum mangles formatting etc. Public gists at are permenent, don't require registration, and are intended for just that purpose.
  • Further to my last post, here's my terribly inelegant (but (for me) working) Word macro/module code that you run once in the Zotero footnote you want to open in Zotero for Firefox itself.

    You need to:
    1. insert a new module in Word (go into the 'Tools | Macros' menu and select the 'Visual Basic Editor' menu item (or click Alt+F11). This should open up the VBA editor.
    2. Create a new module by right clicking on the Modules folder, and selecting "Insert...| Module". The right hand side of the VBA editor should open up with an empty text editor.
    3. Paste this text:

    Const SW_SHOW = 1

    Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _
    (ByVal hwnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long

    Sub ZotNoteIDtoFFox()
    Dim ZotID As String
    With Selection.Find
    .Text = "/items/"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdCharacter, Count:=8, Extend:=wdExtend
    ZotID = Selection.Text

    Dim URLPath As String
    URLPath = "zotero://select/items/0_" & ZotID

    ' The next line is the one to delete the message box once you've got the hang of it

    MsgBox "- Locating Zotero item via: " & URLPath & "(will open useless new tab)" & vbNewLine & "- Once in Firefox, use Ctrl+Alt+Z to see the selected item in Zotero for Firefox" & vbNewLine & vbNewLine & "(This unnecessary message box should be deleted in the macro once you've got the hang of it)"

    Dim RetVal As Long
    On Error Resume Next
    RetVal = ShellExecute(0, "open", "C:\Program Files (x86)\Mozilla Firefox\firefox.exe", URLPath, _
    "<run in folder>", SW_SHOWMAXIMIZED)

    End Sub
  • Sorry, just saw your request that I post the code elsewhere after I'd posted it. I posted it in text, so shouldn't this be ok to copy and paste?

    I hope this is ok. I'd feel embarrassed putting my terrible work on a permanent work on a permanent, programmer's utility. ;-)
  • I like your approach. The only limitation seems to be that this way you is that it handles only once source per citation.
  • Thanks, mronkko. Yes, you make an excellent point, it will always find the first source cited. That was something I hadn't even thought of because I used a very simple test document.

    I can only think of three ways around the problem:

    (1) We could very easily develop separate macros to get the first, second, third etc sources (probably using something unique per citation in the field code like "uris"), but that wouldn't really be satisfactory, because you'd have to work out yourself what number source in the footnote it is.

    (2) A looped macro could presumably open all of the sources of a footnote in separate instances of zotero, but mutliple instances would probably (hopefully) not be possible in Zotero for firefox.

    (3) What I would like is a system whereby you could click on or select the text of the second item in the footnote and, running the macro from there, get the second source in Zotero. Presumably you could search previous for the separator (usually ";") from the cursor in the un-expanded footnote and use the number of hits to work out whether the item is the 1st, 2nd, 3rd etc in the footnote, then use the technique described at (1) above to go to that footnote in Zotero, but that's again just a theoretical approach not backed up by any real understanding of VBA.

    Given that (1) and (2) aren't that helpful and that (3) involves all sorts of functions I don't really understand and would therefore take me a lot of time I don't have in the next little while (my wife will kill me if I srart trying to program this coming weekend away), I think it's better if I leave my contribution with this first-source-only limitation for the time being. My apologies. Hopefully some better programmers than I will be able to tidy it up and build upon it one day so that it overcomes this (and probably other) limitations.
  • There is still one more issue that causes complexity here: In the 3.0 version it is possible that a citation is not linked to your own zotero DB, but is based on metadata that is embedded in the document. (In this case someone else has inserted the citation.) However, from the user perspective, these citations should probably be editable as well.
Sign In or Register to comment.