# Adding Publication in moderncv template

How can I add the following publication (for example) in the moderncv template?

Albert Einstein. Zur Elektrodynamik bewegter K ̈orper. (German) [On the electrodynamics of moving bodies]. Annalen der Physik, 322(10):891–921,1905.

I have created a file called publication.bib where I stored the information:

 @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"
}


Then I have called the publication.bib in document.tex.

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

\moderncvcolor{green}

\usepackage[utf8]{inputenc}

\usepackage[scale=0.75]{geometry}

\name{John}{Doe}
\title{Resumé title}

\phone[mobile]{+1~(234)~567~890}

\phone[fixed]{+2~(345)~678~901}

\phone[fax]{+3~(456)~789~012}

\email{john@doe.org}

\homepage{www.johndoe.com}

\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  % arguments 3 to 6 can be left empty

\bibliographystyle{unsrt}
\bibliography{publication}

\end{document}


The document.tex run normally. But it doesn't show the information contained in publication.bib.

Why doesn't it showing the reference?

• you need to create a file called publications.bib, and input your information there using BibTex. check this out: sharelatex.com/learn/… – Elad Den Jul 3 '18 at 11:17
• @EladDen I have created publication.bib. The document.tex run normally. But it doesn't show the information contained in publication.bib. I have edited my post. – user149054 Jul 4 '18 at 11:25
• You need to \cite or \nocite the works you want to appear in the bibliography list (either explicitly \cite{einstein} which creates a label or \nocite{einstein} which does not, or in general with \nocite{*}). And you need to run BibTeX: tex.stackexchange.com/q/63852/35864 – moewe Jul 4 '18 at 11:45

You nearly did it.

The only thing missing is that you need to use command \nocite{*} to tell BibTeX that all bib entrys should be added to the bibliography.

Please see the following MWE (I used filecontents to have bib file and tex code together in one MWE; important changing is marked with <========):

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@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[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}

\moderncvcolor{green}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}

\name{John}{Doe}
\title{Resumé title}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{john@doe.org}
\homepage{www.johndoe.com}

\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  % arguments 3 to 6 can be left empty

with the resulting page after compiling with pdflatex, bibtex, pdflatex, pdflatex:
• In my publication, there are 9 authors and when I was running the tex file , it was showing the error Package inputenc Error: Keyboard character used is undefined(inputenc) in inputencoding utf8. This error massage has gone by deleting \usepackage[utf8]{inputenc} . – user149054 Jul 5 '18 at 11:00