I am using biblatex with biber from TL2018 for my PhD thesis. Due to various reasons, I am forced to use Mendeley for citation managements and cannot switch to another tool now. Mendeley is capable of generating a bib file - but it is compatible with only the classic natbib/bibtex combo (although it correctly escapes special characters).
I understand that with biblatex/biber combo, the month field is not a string, but rather must be an integer. So, as expected and discussed here, I get the warning
[784] Utils.pm:193> WARN - month field 'Apr' in entry 'coolauthor2012' is not an integer - this will probably not sort properly.
Taking inspiration from a tangentially related question here, I used the following month -> integer hand-conversion in the preamble.
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\step[fieldsource=month, match={jan}, replace=${1}]
\step[fieldsource=month, match={feb}, replace=${2}]
\step[fieldsource=month, match={mar}, replace=${3}]
\step[fieldsource=month, match={apr}, replace=${4}]
\step[fieldsource=month, match={may}, replace=${5}]
\step[fieldsource=month, match={jun}, replace=${6}]
\step[fieldsource=month, match={jul}, replace=${7}]
\step[fieldsource=month, match={aug}, replace=${8}]
\step[fieldsource=month, match={sep}, replace=${9}]
\step[fieldsource=month, match={oct}, replace=${10}]
\step[fieldsource=month, match={nov}, replace=${11}]
\step[fieldsource=month, match={dec}, replace=${12}]
}
}
}
I have two nagging questions now.
- Will this work? I don't see any more of the aforementioned warnings, but I wonder if the citations are correctly sorted, and the month replacement was indeed accounted for and handled correctly.
- Is there a better way to handle this problem? Clearly, hand-mapping each month to an integer is not efficient.
This will help all folks who want to use mendeley especially for re-using their existing mendeley library for manuscript submissions to publishers who are mostly stuck behind in natbib/bibtex era.
month = {apr},is also wrong for most classical BibTeX styles, they just won't complain as loudly as Biber. – moewe Jun 28 '18 at 14:59mendeleyshall always be three-character abbreviations. Am I wrong? Isaprthe only exception? – Dr Krishnakumar Gopalakrishnan Jun 28 '18 at 15:01month = apr,would be correct. Naturallyapris not special and all months behave the same. – moewe Jun 28 '18 at 15:02mendeleydoes indeed generate the month-fields in all entries in the exportedbibfile as{jan}, {feb}, {mar}and so on (with the braces). Also, I have no clue of using regexes. Does it mean that my replacement string is wrong? Should it be, replace=1, I also wonder that that$is doing there. I'd appreciate some help in correctly formulating thismonth -> integerconversion command. – Dr Krishnakumar Gopalakrishnan Jun 28 '18 at 15:06natbib/BibTeX - it usually isn't.) – moewe Jun 28 '18 at 15:08mendeleyis far too popular, particularly in the UK, right? I wonder why would they make such an elementary mistake? And, naturally one expects that such an error should have been noticed by someone else long time time". I am using the latestmendeleyversion 1.19.1. They claimbibtexcompatibility in their manuals/software interface. Is there a credible source/reference link that you could point me to that supports your claim thatmonthabbreviations should not be surrounded by braces? – Dr Krishnakumar Gopalakrishnan Jun 28 '18 at 15:11mendeleycripples its users this way. – Dr Krishnakumar Gopalakrishnan Jun 28 '18 at 15:25monthfield and maybe some people don't care. Plus I'm not sure how large the LaTeX user base of Mendeley is. There are some long-standing issues with Mendeleys.bibexport that have not been fixed (I think I once saw quite an old thread on a Mendeley feedback site about URLs and escaped characters, see also https://tex.stackexchange.com/questions/436684/c/436687#comment1095539_436684). (Re themonths again: https://www.ece.ucdavis.edu/~jowens/biberrors.html) – moewe Jun 28 '18 at 15:31