27

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?

36

\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

  • 5
    For the shamelessly lazy copiers, biblatex requires the .aux to be compiled with biber instead of bibtex. – anderstood Jan 30 '15 at 20:50
  • @anderstood I cannot understand your comment. Can you go into more details? After compiling the above code I don't get the list of publications. – Veliko Jan 7 '17 at 19:50
  • @Veliko If you compile in a terminal (typing e.g. "pdflatex document.tex"), you should compile the bibliography using "biber document" and not "bibtex document". If you are using an editor (texmaker, texnicenter, etc.) you should probably change your configuration settings. – anderstood Jan 13 '17 at 1:33

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.