4

I Adopted this solution for my CV:

Sorted list of publications in moderncv from bibtex

and modified plainyr.bst for my needs.

However, the papers are sorted only by year and author. But it would be better if it is sorted first by year and then by month. I'm using my global bib database created with JabRef.

Is it possible to just sort the entries in the bib file, by year and month?

Here is my example tex:

\documentclass[11pt,a4paper,roman]{moderncv}
\moderncvstyle{casual} 
\moderncvcolor{black} 
\usepackage[utf8]{inputenc} 
\usepackage[scale=0.75]{geometry}

% personal data
\name{A}{B}
\title{C}                               
\address{D}{E}{F}
\phone[mobile]{G}
\phone[fixed]{H} 
\email{I} 
\homepage{J}

\begin{document}
\makecvtitle
\pagestyle{empty}

\section{Publications}

\nocite{december_15}
\nocite{june_15}
\nocite{january_15}
\nocite{may_14}

\bibliographystyle{moderncv}
\bibliography{main}

\clearpage
\end{document}

Here the bibtex file:

@InProceedings{june_15,
  Title                    = {Example Publication 2},
  Author                   = {A, B. and C, D.},
  Booktitle                = {Fancy Publication Example},
  Year                     = {2015},
  Month                    = {June},
}

@InProceedings{january_15,
  Title                    = {Example Publication 1},
  Author                   = {Z, Z. and Z, D.},
  Booktitle                = {Fancy Publication Example},
  Year                     = {2015},
  Month                    = {January},
}

@InProceedings{december_15,
  Title                    = {Example Publication 3},
  Author                   = {D, B. and C, D.},
  Booktitle                = {Fancy Publication Example},
  Year                     = {2015},
  Month                    = {December},
}

@InProceedings{may_14,
  Title                    = {Example Publication 1},
  Author                   = {U, B. and C, D.},
  Booktitle                = {Fancy Publication Example},
  Year                     = {2014},
  Month                    = {May},
}

Here my BST file based on the above mentioned answer.

moderncv.bst: hxxp://tmp.jung.ms/moderncv.bst

This is the actual output I get:

Actual Output

It should be like this (photoshopped):

Intended Output

  • Welcome to TeX.SX! It is easier to help you if you add a minimal working example that takes the form \documentclass{...}\usepackage{....}\begin{document}...\end{document}. If possible, it should compile and have the minimum amount of code needed to illustrate your problem. This makes it much easier for people to troubleshoot your problem - and much more likely that they will! – Andrew Aug 13 '15 at 12:00
2

One way to accomplish this is slightly change the presort function inside your bibTeX style file. Here I'm using the month-based sorting function suggested by keflavich in the answer below.

https://tex.stackexchange.com/a/33332/84764

Code:

FUNCTION {sort.format.month}
{ 't :=
  t #1 #3 substring$ "l" change.case$ "jan" =
    { "01"  }
    { t #1 #3 substring$ "l" change.case$ "feb" =
      { "02"  }
      { t #1 #3 substring$ "l" change.case$ "mar" =
        { "03"  }
        { t #1 #3 substring$ "l" change.case$ "apr" =
          { "04"  }
          { t #1 #3 substring$ "l" change.case$ "may" =
            { "05"  }
            { t #1 #3 substring$ "l" change.case$ "jun" =
              { "06"  }
              { t #1 #3 substring$ "l" change.case$ "jul" =
                { "07"  }
                { t #1 #3 substring$ "l" change.case$ "aug" =
                  { "08"  }
                  { t #1 #3 substring$ "l" change.case$ "sep" =
                    { "09"  }
                    { t #1 #3 substring$ "l" change.case$ "oct" =
                      { "10"  }
                      { t #1 #3 substring$ "l" change.case$ "nov" =
                        { "11"  }
                        { t #1 #3 substring$ "l" change.case$ "dec" =
                          { "12"  }
                          { "00"  } % No match
                        if$
                        }
                      if$
                      }
                    if$
                    }
                  if$
                  }
                if$
                }
              if$
              }
            if$
            }
          if$
          }
        if$
        }
      if$
      }
    if$
    }
  if$
}

FUNCTION {presort}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.sort
    { type$ "proceedings" =
        'editor.organization.sort
        { type$ "manual" =
            'author.organization.sort
            'year.sort
          if$
        }
      if$
    }
  if$
  "    "
  *
  month field.or.null
  sort.format.month
  *
  "    "
  *
  author field.or.null
  sort.format.names
  *
  "    "
  *
  title field.or.null
  sort.format.title
  *
  #1 entry.max$ substring$
  'sort.key$ :=
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.