# Incompatible month formats between biblatex and Mendeley

As the title suggests, I'm using Mendeley as my reference manager (which automatically generates a .bib file for the entire bibliography) and biblatex with BibTeX as the backend to handle the bibliography. As I've seen in related threads, biblatex wants the month field as in integer between 1 and 12; however Mendeley only exports months as the standard 3 letter BibTeX-compatible abbreviation. Bearing in mind that I can't really play around with the .bib file as it's auto generated, is there any way I can get biblatex to play nice with three letter abbreviated months? (N.B. it still compiles, just throws a lot of warnings)

MWE

\documentclass[a4paper,12pt]{report}

\usepackage[sorting=none,backend=bibtex]{biblatex}

\bibliography{mwebib}

\begin{document}

foo\cite{bar}

\printbibliography

\end{document}


With mwebib.bib

@article{bar,
archivePrefix = {arXiv},
arxivId = {astro-ph.IM/1107.4806},
author = {{The Pierre Auger Collaboration}},
eprint = {1107.4806},
journal = {ArXiv e-prints},
month = {jul},
primaryClass = {astro-ph.IM},
title = {{The Pierre Auger Observatory IV: Operation and Monitoring}},
year = {2011}
}

• For those of us no using Mendeley, an example .bib entry would be handy. For example, I wonder if you mean that it's creating string entries of the form month = jan, which can then be defined as @string{jan = "1"}. – Joseph Wright Jan 6 '16 at 9:32
• If you can use biber, it defines the standard macros internally and maps them to the biblatex numbers automatically. – PLK Jan 6 '16 at 9:50
• Note that the proper way to give full dates in biblatex is the date field (in YYYY-MM-DD format - you may of course leave out the day or the month and day). But you can use the fields year and month for backwards compatibility. (You can, however, not give the full date using a day field, it will be ignored.) Would it be possible to show an example of what Mendeley exports? – moewe Jan 6 '16 at 16:03
• I just tested the example from Bibliography using Texshop and Mendeley export with both Biber and BibTeX and got the expected output with both back-ends (and no warnings or errors). So I will really need an example to understand what is going on. It would also be helpful if you could show us the warnings you get to see and whether you get unexpected output. – moewe Jan 6 '16 at 16:09
• sorry all, I should have included a .bib: @article{bar, archivePrefix = {arXiv}, arxivId = {astro-ph.IM/1107.4806}, author = {{The Pierre Auger Collaboration}}, eprint = {1107.4806}, journal = {ArXiv e-prints}, keywords = {Astrophysics - High Energy Astrophysical Phenomena,Astrophysics - Instrumentation and Methods for Ast,High Energy Physics - Experiment,Physics - Instrumentation and Detectors}, month = {jul}, primaryClass = {astro-ph.IM}, title = {{The Pierre Auger Observatory IV: Operation and Monitoring}}, year = {2011} } – user95308 Jan 7 '16 at 2:58

The standard BibTeX abbreviations should not be given in braces, but bare as in

month = mar,


only then does BibTeX understand their special meaning.

It's better having a numerical value, or an abbreviation, instead of the complete name of the month.

There it is not that clear that the abbreviation needs to be give without braces or quotation marks.

on p. 44 it says

Namely, for instance, months should be entered numerically.

So month = {jul}, is not the format recommended by Tame the Beast.

Have a look at the following BibTeX example

\documentclass{article}
\begin{filecontents}{\jobname.bib}
@article{Blavatskyy2011,
author = {Blavatskyy, Pavlo R.},
doi = {10.1287/mnsc.1100.1285},
month = mar,
number = {3},
pages = {542--548},
title = {{A Model of Probabilistic Choice Satisfying First-Order Stochastic Dominance}},
volume = {57},
year = {2011},
}

@article{bar,
author = {{The Pierre Auger Collaboration}},
eprint = {1107.4806},
journal = {ArXiv e-prints},
month = {jul},
title = {{The Pierre Auger Observatory IV: Operation and Monitoring}},
year = {2011}
}
\end{filecontents}

\begin{document}
These are my works, \cite{Blavatskyy2011,bar}

\bibliographystyle{plain}
\bibliography{\jobname}
\end{document}


The month wrapped in braces does not give the expected result.

The same holds if you use biblatex with the BibTeX back-end. The new back-end Biber is so clever that it can even deal with braced month fields

So the following MWE will give the expected output (with backend=bibtex though, it won't work as expected).

\documentclass{article}
\usepackage[backend=biber]{biblatex}
\begin{filecontents}{\jobname.bib}
@article{Blavatskyy2011,
author = {Blavatskyy, Pavlo R.},
doi = {10.1287/mnsc.1100.1285},
month = mar,
number = {3},
pages = {542--548},
title = {{A Model of Probabilistic Choice Satisfying First-Order Stochastic Dominance}},
volume = {57},
year = {2011},
}

@article{bar,
author = {{The Pierre Auger Collaboration}},
eprint = {1107.4806},
journal = {ArXiv e-prints},
month = {jul},
title = {{The Pierre Auger Observatory IV: Operation and Monitoring}},
year = {2011}
}
\end{filecontents}

\begin{document}
These are my works, \cite{Blavatskyy2011,bar}

\printbibliography
\end{document}


Even though Biber has no problems with the file exported from Mendeley I still consider the export faulty, since BibTeX cannot properly deal with this.

So if you cannot change the .bib file and still want to get rid of the warnings you should try and use Biber.

• thanks for that; unfortunately that's what I was expecting. I've switched over to biber now: \usepackage[sorting=none,backend=biber]{biblatex} and am running pdflatex biber pdflatex pdflatex. however now when I run biber, every single \cite command throws the warning Citation 'wulf1909' on page 1 undefined etc. I've deleted the .bbl and .aux files, are there any other changes I need to make? the .bib file is the same as before. – user95308 Jan 8 '16 at 5:00
• @user95308 If you really run Biber (if you use an editor, check the configuration) and have \usepackage[sorting=none,backend=biber]{biblatex} everything should work especially if you got rid of the .aux, .bbl and .bcf. Note that you need tor run Biber on the .bcf file, not the .aux file (or better yet: leave the file ending and let Biber figure it out). See also this go-to question for problems such as this. – moewe Jan 8 '16 at 6:52
• @user95308 Check also if you can get \documentclass{article} \usepackage[backend=biber]{biblatex} \addbibresource{biblatex-examples.bib} \begin{document} \nocite{sigfridsson} \printbibliography \end{document} to work. Check what the .blg file says. – moewe Jan 8 '16 at 6:53
• I use texstudio, so I've configured it to use the chain I previously mentioned (pdflatex -> biber -> pdflatex -> pdflatex). my .blg file tells me I found no \citation commands---while reading file main.aux I found no \bibdata command---while reading file main.aux I found no \bibstyle command---while reading file main.aux – user95308 Jan 8 '16 at 13:39
• @user95308 If you get that error you are definitely not running Biber but BibTeX. Please refer to Biblatex with Biber: Configuring my editor to avoid undefined citations for the correct setup of Biber in your editor. – moewe Jan 8 '16 at 16:33

I use python to change the month field in the bib file. Put python code file in the folder of your bib file. Then run python code_file.py bib_file.bib

#!/bin/env python
# -*- coding:utf-8 -*-

import sys
import re

def replace(file_path):
try:
f = open(file_path,'r+')
f.seek(0)
f.truncate()
re_pattern = re.compile(r'month = {(?P<month>[^}]*)}')
for line in all_lines:
line = re_pattern.sub(r'month = \g<month>', line)
f.write(line)
f.close()
except Exception:
print("something wrong!")

if __name__ == "__main__":
if len(sys.argv) < 1:
print("need filename")
sys.exit(1)
file_name = sys.argv[1]
replace(file_name)

• Welcome to TeX.SE! – Mensch Jul 15 at 6:06