1

Tame the Beast suggests to use plain integers over strings in the month key.

I have mixed month formats in my .bib file and want a unique solution. Which tools can convert the different strings like "jan" and "Jan" (wrapped in 0 to 2 pairs of {}) to 1?

3
  • If there is nothing ready to use, I will write a brute force sed script. I thought I was not the first with this problem... Commented Jan 29, 2017 at 21:36
  • probably it's been done before but the sed script wouldn't be much longer than the question:-) Commented Jan 29, 2017 at 21:37
  • I started, but it is not so easy, as it initially seemed. I have to check, that the line starts somewhere with Month sometimes the months are wrapped in one or two {} brackets too and cases are mixed. Commented Jan 29, 2017 at 21:55

2 Answers 2

3

given this not very valid bib file

aaa.bib
year= jan
journal="jan of feb of dec"
month="1"
month = "Jan"
month=  "{{jan}}"
month=  {{jan}}
month=  {jan}
month=  "2"
month=  {Jan}
author="Jan de Groote"

The following command

 sed -e 's/\(^ *month\) *= *["{]{*jan}*[}"]/\1 = "1"/i' aaa.bib

outputs

aaa
year= jan
journal="jan of feb of dec"
month="1"
month = "1"
month = "1"
month = "1"
month = "1"
month=  "2"
month = "1"
author="me"

which looks like the right thing, so you just want 11 more similar lines and it should be done (save a copy of your file first!!)

2
3

Quoting ttb:

It’s better having a numerical value, or an abbreviation

Quoting biblatex manual:

This must be an integer, not an ordinal or a string.

In JabRef, we nevertheless decided to go for abbreviations, which did not cause trouble on our side:

@Article{,
  month = jun,
}

To achieve that, press Alt+F8 or Quality -> Cleanup Entries... Then, following dialog appears:

clean up entries

If the contents of "Run field formatter" look different, just press "Recommended for BibTeX".

With File -> "Switch to biblatex mode", one can switch to biblatex mode and then have "Recommended for biblatex".

clean up defaults for biblatex

1
  • 2
    It doesn't matter if its a literal or a number, if you use the DATE field (YYYY-MM-DD) of biblatex it overrides the month field. JabRef is also able to convert from year+month field to date Commented Jan 30, 2017 at 9:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .