My question is similar to How to sort a .bib file with biber?
I have a .bib file which is generated by Mendeley. Because it is generated, the entries are not formatted nor ordered. Also the order changes completley whenever I add something in Mendeley.
Because I use git to track changes, I want to have a sorted and formatted bib file. This would lead to nice diffs/commits where one could easily see what has changed.
I got the formatting part, but I am not able to make biber sort the file. For my task it is irrelevant what the sorting parameter is, as long as sorting two different files with the same entries leads to the same sorting. So lets assume we want to sort according to the citation key.
What I got so far is:
biber -tool C:\SomePath\unordererd.bib --output_indent=4 --output_fieldcase=lower --output-file=C:\AAAA\SomePath\output.bib
This gives me a nice format, but the entries are not sorted.
This is the output i get
INFO - This is Biber 2.3 running in TOOL mode ... INFO - Overriding locale 'en_US' defaults 'variable = shifted' with 'variable = non-ignorable' INFO - Overriding locale 'en_US' defaults 'normalization = NFD' with 'normalization = prenormalized' INFO - Sorting list 'none' of type 'entry' with scheme 'none' and locale 'en_US' INFO - No sort tailoring available for locale 'en_US' ...
Obviously, biber thinks about sorting, but does nothing about it. I also tried providing a biber.conf like in the other question, but with no success.
If someone has the same issue, this is my final config file. It also includes some filter to clean up the file:
- it removes
mendeley-tagsfields from every entry
- it removes
urlfields from some entries
<config> <sorting> <presort>mm</presort> <sort order="1"> <sortitem order="1">title</sortitem> </sort> <sort order="2"> <sortitem order="1">year</sortitem> </sort> </sorting> <sourcemap> <maps datatype="bibtex" map_overwrite="1"> <map> <map_step map_field_set="ABSTRACT" map_null="1"/> <map_step map_field_set="FILE" map_null="1"/> <map_step map_field_set="keywords" map_null="1"/> <map_step map_field_set="mendeley-tags" map_null="1"/> </map> <map> <per_type>ARTICLE</per_type> <per_type>BOOK</per_type> <per_type>inproceedings</per_type> <per_type>incollection</per_type> <map_step map_field_set="URL" map_null="1"/> </map> </maps> </sourcemap> </config>
I also added these two parameters to the commandline: