[Tex/LaTex] No numbers in bibliography for moderncv

bibliographiesmoderncv

So I'm using moderncv and for whatever reason whenever I try and add a bibliography, they all come back not numbered. Here's a MWE:

texfile:

\documentclass{moderncv}
\moderncvstyle{classic}
%\usepackage{multibib}


\begin{document}
    \nocite{*}
    \bibliographystyle{abbrv}
    \bibliography{biblio}
\end{document}

File biblio.bib:

@book{abook,
    Title           = {Some Book},
    Author          = {Me},
    Publisher       = {A human},
    Year            = {2018},
}

This is giving me a bibliography, but it is not numbered at all. I tried different bibliography styles, and nothing. I also tried using multibib and nothing worked. Any ideas?

Best Answer

To get numbered bibliography entrys you have to add the following line in your preamble:

\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}

Because there is an @ used you have to enclose this line with \makeatletter and \makeatother.

With the following MWE (please see that I added the missing name):

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{abook,
    Title           = {Some Book},
    Author          = {Me},
    Publisher       = {A human},
    Year            = {2018},
}
@article{einstein,
  author  = "Albert Einstein",
  title   = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
              [{On} the electrodynamics of moving bodies]",
  journal = "Annalen der Physik",
  volume  = "322",
  number  = "10",
  pages   =  "891--921",
  year    = "1905",
  DOI     = "http://dx.doi.org/10.1002/andp.19053221004"
}
\end{filecontents*}


\documentclass{moderncv}

\moderncvstyle{classic}

\makeatletter
\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
\makeatother

\firstname{John}
\familyname{Doe}


\begin{document}
  \nocite{*}
  \bibliographystyle{abbrv}
  \bibliography{\jobname}
\end{document}

you get the wished result:

pdf result

Related Question