Inline citing while you type in MS Word / OO Writer

See http://www.peaya.com/cite/ for a very nice example of how citing can be very very easy. Now inserting a reference steals focus from the keyboard and forces me to use a mouse. Some similar to peaya would be brilliant.
  • Looks nice at first, is actually quite limited - no search function, no access to collections, unclear how suppress author would work, even prefix/suffix would probably be hard to do properly, so this really mostly works for people doing numerical citations.
    I don't think you actually need a mouse to use the current feature - you can tie it to shortcut and then use arrows and tab in the add citation window.
  • Investigating tying inserting a ref to a shortcut, that would be indeed sufficient.
  • I have written the code below to add the desired functionality to MS Word! It automagically pops-up the insert citation window after typing "{{".

    Add the code below to the macros of your normal.dot:

    Sub AssignKey() 'Assign a macro to key combination of square brace and shift
    CustomizationContext = NormalTemplate
    KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyOpenSquareBrace, wdKeyShift), _
    KeyCategory:=wdKeyCategoryMacro, Command:="CheckDoubleOpenCurlyBrace"
    End Sub
    Sub CheckDoubleOpenCurlyBrace()
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    If Not StrComp(Selection.Text, "{", vbTextCompare) Then
    Application.Run "ZoteroInsertCitation"
    Else
    Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.Text = "{"
    Selection.EndKey
    End If
    End Sub
  • I've written about similar (if more ambitious; where hinting is based on context of the citation) ideas previously. I definitely think the idea is a major improvement on the really tedious context switching that currently happens. But as adamsmith says, there are a lot of details to work out.
  • b.c.hamans, this is cool—we may try to work something like this into a later Word plug-in.
  • Minor update to remove some undesired behavior. First problem was jumping of the cursor to the end of a line when inserting a single "{"-brace in the middle of a line. Second problem occurred when a character sequence contained two or more "{"-braces. E.g. typing "{sometext{" would trigger Zotero. Both problems should be fixed by the changed VB code below:

    Sub CheckDoubleOpenCurlyBrace()
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    If Not StrComp(Selection.Text, "{", vbBinaryCompare) Then
    Application.Run "ZoteroInsertCitation"
    Else
    Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.TypeText ("{")
    End If
    End Sub

    Maybe a bit needles to say but to insert the character sequence "{{" without invoking Zotero type the sequence "{ {" and simply remove the space character using backspace or delete.
Sign In or Register to comment.