[Tex/LaTex] Bibtex JabRef and moderncv

bibtexmoderncvtexmaker

I am trying to create my cv using moderncv class. Everything look fine until the publication section. I have a publication database under the title "publications.bib" that is created in JabRef. I want to use import the publications included in this database in my cv. I tried to modify the plainyr.bst file like here Sorted list of publications in moderncv from bibtex but did not work, apparently it leaves the section empty. Here is a MWE:

\documentclass[11pt,a4paper]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{grey}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}

\end{filecontents}
\renewcommand{\familydefault}{\sfdefault}
\nopagenumbers{}

\usepackage[utf8]{inputenc}
\firstname{E}
\familyname{Xample}
\begin{document}

\section{Publications}
\nocite{*}
\bibliographystyle{moderncv}
\bibliography{\jobname}
\end{document}

Even when I don't use the .bib and work just like in the first answer of the above link, having:

\documentclass{moderncv}
\moderncvstyle{classic}  
\moderncvcolor{blue}       

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{A01,
  author = {Author, A.},
  journal = {Good Journal},
  year = {2001},
  title = {Alpha},
}

\end{filecontents}

\firstname{E}
\familyname{Xample}
\begin{document}

\section{Publications}
\nocite{*}
\bibliographystyle{plainyrrev}
\bibliography{\jobname}

\end{document}

In the pdf file, I get just printed the section "Publications" and nothing is included in that. However, a .bib file is created that has the entry of the article.

Any idea?

Best Answer

I found what the problem was. Everytime I change the .bib file, I have to change into the .aux file the line that defines the style \bibstyle{moderncv} to \bibstyle{plainyr}. Then I compile the .bib file and then I create the pdf. Everything works fine!