Disambiguate first name only when same year

Is there anyway to disambiguate between citations by providing the first name only when the year of the citation is the same?

What I mean is, right now if I choose to disambiguate first names my citations look like this:

(Brown, J. 2008) (Brown, J. 2005) (Brown, D. 2008)

I'd rather that the initial only appears when the year is the same so:

(Brown, J. 2008) (Brown 2005) (Brown, D. 2008)

Is this possible? (I am using my own custom citation style.)
  • Yes. Use givenname-disambiguation-rule
  • Fantastic. I somehow missed that. Thanks very much.
  • Actually, after some testing this doesn't work quite as I would expect.

    I'm using givenname-disambiguation-rule="by-cite".

    If I have a John Brown citation (Brown 2008) then I add a Don Brown citation with the same year, the Don Brown citation comes up as (Brown, D. 2008). BUT the John Brown citation remains unchanged even after I refresh. I would have expected the John Brown citation to change to (Brown, J. 2008).

    If, after adding both citations, I used the John Brown citation again, THEN it will appear as (Brown, J. 2008). BUT the original John Brown citation entered before the first Don Brown citation remain as (Brown 2008).

    Is there some way to fix this? Am I missing something?
  • It may be a bug. This end of disambiguation is up for some rewriting in the code; the logic can be made simpler and cleaner, and I think the changes I'm planning will address this. Please bear with; it might take a few weeks for me to get to it.
  • OK no worries. Appreciate the support.
  • Josh - as a workaround - would it work to delete the Brown cite w/o disambiguation and re-insert it?
  • Yes that works. It also works if I just edit the Brown cite w/o disambiguation, don't change anything, and press OK.

    So this workaround is ok. But considering the number of users in my organisation and the length of our documents, fixing the bug would certainly be appreciated!
  • but clicking "refresh citations" (or whatever that setting is called) doesn't work?
    Zotero's word plugin has fairly recently been changed to only update citations that actually change - it sounds like there is something going wrong in the communication between plugin and csl processor.
  • Refresh just makes citeproc-js regenerate citations sequentially and updates the document with those. Since that produces incorrect results here, refreshing won't fix anything.
  • Yes that's right. Refresh doesn't work.
  • edited January 12, 2012
    JoshCraig: Just a couple of things to confirm before I wander off to other things. First, have you validated your custom style against the CSL 1.0 schema? Second, there should be a "class" attributed on the style tag (the outermost block of the style), more or less like this:
    class="XXXX" version="1.0"

    What value is in the XXXX position?
  • I have the class attribute: class="in-text"

    I haven't validated it against the schema. In fact, I'm not quite sure what that means.

    I created my custom style by adapting the University of South Australia 2011 style which happened to be closest to what I need. As it was publicly available I can only assume it was validated.
  • validation: https://github.com/citation-style-language/styles/wiki/Validation

    it would be helpful if you could make sure your style actually does validate.
  • grrr. I get a bad gateway error when I use validator.nu

    Maybe its the security settings at my work?

    I'll give it a go at home this evening.
  • Here's the output from validator.nu:

    Warning: Being lax about non-RNC Content-Type: text/plain
    Warning: Being lax about non-RNC Content-Type: text/plain
    Warning: Being lax about non-RNC Content-Type: text/plain
    Warning: Being lax about non-RNC Content-Type: text/plain
    Warning: Being lax about non-RNC Content-Type: text/plain
    IO Error: Non-XML Content-Type: text/x-csl.
  • Did you: "In the "Parser" drop-down menu, select the "XML; don't load external entities" option. Also check the "Be lax about HTTP Content-Type" check-box." ?
  • just post the style to a public gist at gist.github.com and we can take a look. Even if that validates it will also be helpful for troubleshooting.
  • edited January 14, 2012
    I've just completed changes to the disambiguation code in citeproc-js that will almost certainly address the name mismatch issue (and if not, bring us to a point where fixing any remaining glitch will be trivial coding). I'll check in the code after a final run of the test suite, and it will just be a matter of time (a week or two, likely) before the revised code becomes available in the Zotero 3.0 beta.

    The new code is simpler, and should run slightly faster on documents that make heavy use of disambiguation.

    (Edit: the updated processor [version 1.0.260] has been checked in.)
  • Here it is:


    Apologies for any messiness in the code. I am very new to programming.
  • There are two issues with the style. It needs an "id" element inside info (around line 18 or so) like this:
    There is also an unneeded (and invalid) label element around line 104, that can just be removed.
  • Fixed. Thanks very much for all your help.
  • edited January 19, 2012
    Just a note on the "IO Error: Non-XML Content-Type: text/x-csl."

    Upon upload, the document mimetype is set by the browser based on the file extension. text/x-csl refers to the .csl file extension and is not recognized as an xml type by Validator.nu Changing the file extension to .xml fixes this error (this would have to be reverted to .csl for Zotero of course)

    Copy-pasting avoids this issue altogether.
  • ah yes that makes sense - I never upload. Either c&paste or use the link to the style if it's already up somewhere.
  • I thought this used to work.
Sign In or Register to comment.