[Tex/LaTex] Creating bibliographies with biblatex and moderncv

biblatexmoderncv

I wanted to use the moderncv class together with biblatex. To this end, I redefined the bibliography bibenvironment

\defbibenvironment{bibliography}{}{}%
{\cvline{\printfield[labelnumberwidth]{labelnumber}}%
{}
}

The labels were adjusted correctly, but the text of the bib entry (unsurprisingly) started below the label, took the whole line and was not adjusted at all.

My question is if there is a neat solution for this, or if one must define a new BibliographyDriver as is done here Sorted list of publications in moderncv from bibtex or even resort to some low level hackery as in this answer tabular bibliography with biblatex? If so, what do I have to do?

Best Answer

\defbibenvironment pretty much takes the same arguments as \newenvironment. For the standard numeric styles the default bibliography environment is defined in numeric.bbx. You can adapt this definition to use the list layout parameters for moderncv's thebibliography environment. The following document takes the parameters from moderncvstyleclassic.sty.

\documentclass{moderncv}
\usepackage{biblatex}

\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{% label format from numeric.bbx
        \printfield{labelprefix}%
        \printfield{labelnumber}}}
     {\setlength{\topsep}{0pt}% layout parameters from moderncvstyleclassic.sty
      \setlength{\labelwidth}{\hintscolumnwidth}%
      \setlength{\labelsep}{\separatorcolumnwidth}%
      \leftmargin\labelwidth%
      \advance\leftmargin\labelsep}%
      \sloppy\clubpenalty4000\widowpenalty4000}
  {\endlist}
  {\item}

\moderncvstyle{classic}  
\moderncvcolor{blue}       
\firstname{John}
\familyname{Doe}

\addbibresource{biblatex-examples.bib}
\begin{document}
\makecvtitle
\nocite{companion,knuth:ct:a,knuth:ct:b}
\printbibliography[title={Publications}]
\end{document}

enter image description here