Warn if page cited is outside page range


Just a simple feature that could reduce typing or tiredness-induced errors:

If the page specified in the word-processor citation falls outside the range specified in an articles page field, warn the user.

For instance:

Martin Paul Eve, "Some Article," Some Journal, 2011, 10-20.

I try and cite the article on page 22, which is not inside the page range; it would be great if Zotero could warn me that it looks like I've made a mistake.

  • edited March 4, 2011
    It would be quite tough to do this. It would need to work for all ranges, and you'd be surprised at the variety of "numbers" that occur in citations. Open ranges are one obvious item, but a harder case is ranges of compound numbers (which the processor handles during formatting). As an example, here is one of the result strings from the test suite (used to check that the CSL processor is working correctly):Example: minimal, at 110–115
    Example: prefix on one number only, at N110–N115
    Example: same prefix on both numbers, at N110–N115
    Example: different prefixes on both numbers, at N110–P5
    Example: leading number before prefix, at 123N110–N115
    Example: multiple ranges, at 123N110–N115, 456K200–K299
    Example: first less than second, at 123N110–N115, 000c23–22
    I'm not sure how you would go about evaluating whether a given string lies between most of these end points, but I'm pretty sure that it would cost more in time to implement it than the small amount of time that might be saved. It's a pretty safe bet that this won't be implemented, at least in the short or medium term.
  • Hi,

    Hmm, I suppose there are a great deal more numeric possibilities than I'd considered. That said (in C#/pseudocode):

    string[] pageSplit = pages.split("-");

    int first = int.parse(pageSplit[0]);
    int second = int.parse(pageSplit[1]);

    if (page < first || page > second)
    // alert the user

    } catch (Exception)
    // do nothing

    would do the trick to deal with simple integer page numbers.

    P.S. This was less a proposal to do with saving time as to do with catching mistakes which would otherwise go unnoticed.

    Thanks again,

  • edited March 5, 2011
    Yes, that would do the trick for pure numeric ranges. I'm just a little reluctant about introducing a facility that catches only some cases (although admittedly pure numeric ranges are the most common). Ideally, my own sense, at least, is that changes to behavior should not give rise to a need for technical explanations to non-technical users down the road.

    (Edit: I should add that this is just my personal opinion; this would be a change in Zotero proper, and so would belong to the core developers.)
  • Thanks again for the response.

    I, too, am wary of features that only work in a subset of cases. It is, as you point out, however, the majority of cases. The dialogue can also be couched in gentle terms: "It appears the page number you have entered is outside the range entered for the item". Could even be disabled by default and added as an advanced "strict mode" feature.

    Probably not worth it for such a small feature request, I guess; was just an idea as I did accidentally have the wrong page set specified the other day when I'd duplicated an item, wanting to cite two pieces from the same book.


Sign In or Register to comment.