How can I replace sequential citation numbers with an en dash in the ACS bibliography style for Microsoft Word?

84 Views Asked by At

I need to change a little bit of the ACS bibliography style for Microsoft Word to suit my needs. There's a line of code for the citations that has a separator:

<citation>
      <openbracket>(</openbracket>
      <closebracket>)</closebracket>
      <separator>, </separator>

The result would be that if the user cited more than one reference it would like like this:

The chemicals were sufficient (1, 2, 3).

However, I need it to remove the numbers in between if they were in sequence and replace them with an en dash.

The chemicals were sufficient (1–3).

So far, I got almost everything I needed from the file except how to check for if there were a sequence of numbers and replace the numbers in between with an en dash. Here are a few examples of what I need:

  1. The chemicals were sufficient (1). [This works]
  2. The chemicals were sufficient (1, 2). [This works]
  3. The chemicals were sufficient (1–3). [I need to implement this]
  4. The chemicals were sufficient (1, 3–6). [ I need to implement this]

Here is a link to the code: https://github.com/codingo/BibWord/blob/master/source/BibWord/Styles/ACSCitSeq.xsl

The separator is found on line 138.

0

There are 0 best solutions below