[Tex/LaTex] Sort moderncv publications by year AND month (multibib + *.bib file)

bibliographiesmoderncv

I am using moderncv to create my CV. I want to sort the publications in chronologically descending order (not just by year, but by month as well). I have googled a lot of solutions and found a BiB style file named plainyrrev.bst. Here is the link: plain year reverse (seems not to work longer). However, this BiB style file can only sort publication date in descending order by year. Publications in the same years are not strictly sorted in descending order by month. In my case, March 2013 has appeared before October 2013.

I am using multibib package to separate journal publications from conference publications. Here's the TeX code:

\documentclass[10pt,legalpaper,roman]{moderncv}

\moderncvstyle{banking}
\moderncvcolor{red}
\renewcommand{\familydefault}{\rmdefault}
\usepackage[scale=0.75]{geometry}

\name{John}{Doe}
\title{Resum\'{e}}

\makeatletter
\renewcommand*{\bibliographyitemlabel}{[\arabic{enumiv}]}
\makeatother

\usepackage{multibib}
\newcites{jrnl}{Journal papers}


\begin{document}

\makecvtitle
\section{Selected publications}
\nocitejrnl{*}
\bibliographystylejrnl{plainyrrev}
\bibliographyjrnl{journalpapers}

\renewcommand{\refname}{Conference papers}
\nocite{*}
\bibliographystyle{plainyrrev}
\bibliography{confpapers}

\end{document}   

The BibTeX source of journalpapers.bib is as follows:

@ARTICLE{xxd1,
  author = {A and B and C},
  title = {Article title 1},
  journal = {Journal name},
  year = {2014},
  volume = {3},
  pages = {1-5},
  number = {2},
  month = {April}
}

@ARTICLE{xxd2,
  author = {A and B and C},
  title = {Article title 2},
  journal = {Journal name 2},
  year = {2013},
  volume = {1},
  pages = {1-10},
  number = {1},
  month = {October}
}

@ARTICLE{xxd3,
  author = {A and B and C and D},
  title = {Article title 3},
  journal = {Journal name 3},
  year = {2013},
  volume = {2},
  pages = {2-5},
  number = {2},
  month = {March}
}

The BibTeX source of confpapers.bib is as follows:

@INPROCEEDINGS{xxdc1,
  author = {Author 1},
  title = {Title 1},
  booktitle = {Conference 1},
  year = {2012},
  pages = {1-5}
}

@INPROCEEDINGS{xxdc2,
  author = {Author 2},
  title = {Title 2},
  booktitle = {Conference 2},
  year = {2010},
  pages = {9-10}
}

@INPROCEEDINGS{xxdc3,
  author = {Author 3},
  title = {Title 3},
  booktitle = {Conference 3},
  year = {2011},
  pages = {30-35}
}

Below is the created CV. All conference papers are sorted by year, as expected. Journal papers are sorted by year as well, but not by month, see the 2nd and 3rd journal paper.
Created CV

How can I sort the publications in descending order by both year and month? or even day? Please refer to the given link for style file code I am currently using.

Thank you!

Best Answer

Instead of fighting with the sorting procedures there is---in my opinion---an easier way.

You can use a bibliography style which does not sort the entries in the bib files, for example style unsortdin.

Then you can write your bib files and sort the entries by your own: the first paper is the lowest, the next paper you write above etc. Same for Theses or other works.

For example see this changed bib file of you:

@ARTICLE{xxd3,
  author = {A and B and C},
  title = {Article title April 2014},
  journal = {Journal name},
  year = {2014},
  volume = {3},
  pages = {1-5},
  number = {2},
  month = {April}
}

@ARTICLE{xxd2,
  author = {A and B and C},
  title = {Article title October 2013},
  journal = {Journal name 2},
  year = {2013},
  volume = {1},
  pages = {1-10},
  number = {1},
  month = {October}
}

@ARTICLE{xxd1,
  author = {A and B and C and D},
  title = {Article title March 2013},
  journal = {Journal name 3},
  year = {2013},
  volume = {2},
  pages = {2-5},
  number = {2},
  month = {March}
}

I added by using package filecontents both changed bib files into the following MWE.

At last this sorting in the BiB files is mutch more easier than to write an own .bst file or change an existing one.

No you have only to change the BiB style in the MWE to unsortdin to get the result you want (See marks <======= in the MWE).

MWE:

\RequirePackage{filecontents}
\begin{filecontents*}{209082-journal.bib}
@ARTICLE{xxd3,
  author = {A and B and C},
  title = {Article title April 2014},
  journal = {Journal name},
  year = {2014},
  volume = {3},
  pages = {1-5},
  number = {2},
  month = {April}
}

@ARTICLE{xxd2,
  author = {A and B and C},
  title = {Article title October 2013},
  journal = {Journal name 2},
  year = {2013},
  volume = {1},
  pages = {1-10},
  number = {1},
  month = {October}
}

@ARTICLE{xxd1,
  author = {A and B and C and D},
  title = {Article title March 2013},
  journal = {Journal name 3},
  year = {2013},
  volume = {2},
  pages = {2-5},
  number = {2},
  month = {March}
}
\end{filecontents*}

\begin{filecontents*}{209082-conf.bib}
@INPROCEEDINGS{xxdc3,
  author = {LastnameC, firstnameC},
  title = {Title (2012)},
  booktitle = {Conference 1},
  year = {2012},
  pages = {1-5}
}
@INPROCEEDINGS{xxdc2,
  author = {LastnameB, firstnameB},
  title = {Title (2011)},
  booktitle = {Conference 3},
  year = {2011},
  pages = {30-35}
}
@INPROCEEDINGS{xxdc1,
  author = {LastnameA, firstnameA},
  title = {Title (2010)},
  booktitle = {Conference 2},
  year = {2010},
  pages = {9-10}
}
\end{filecontents*}


\documentclass[10pt,legalpaper,roman]{moderncv}

\moderncvstyle{banking}
\moderncvcolor{red}

\renewcommand{\familydefault}{\rmdefault}
\usepackage[scale=0.75]{geometry}

\name{John}{Doe}
\title{Resum\'{e}}

\makeatletter
\renewcommand*{\bibliographyitemlabel}{[\arabic{enumiv}]}
\makeatother

\usepackage{multibib}
\newcites{jrnl}{Journal papers} % ================ needs bibtex jrnl.aux


\begin{document}

\makecvtitle
\section{Selected publications}
\nocitejrnl{*}
\bibliographystylejrnl{unsrtdin}% plainyrrev <==========================
\bibliographyjrnl{209082-journal}

\renewcommand{\refname}{Conference papers}
\nocite{*}
\bibliographystyle{unsrtdin}% plainyrrev <==============================
\bibliography{209082-conf}

\end{document}

and the result:

result of mwe