I'm new with Mactex and I've been trying to insert references; however, even when I use the sample templates, the question mark is printed instead of citation number and my references does not print. Here is sample of my code and the printed document: sample of "references.bib" file:
@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"
}
@book{latexcompanion,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The \LaTeX\ Companion",
year = "1993",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts"
}
@misc{knuthwebsite,
author = "Donald Knuth",
title = "Knuth: Computers and Typesetting",
url = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html"
}
and here is sample of my main code:
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[square,numbers]{natbib}
\bibliographystyle{unsrtnat}
\title{Bibliography management: \texttt{natbib} package}
\author{Share\LaTeX}
\begin{document}
\maketitle
This document is an example of \texttt{natbib} package using in bibliography management. Three items are cited: \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, the Einstein journal paper \cite{einstein}, and the Donald Knuth's website \cite{knuthwebsite}. The \LaTeX\ related items are \cite{latexcompanion,knuthwebsite}.
\medskip
\bibliography{references}
\end{document}
and this is the printed document:

Akso, this is the warning that I get:
Package natbib Warning: Citation `knuthwebsite' on page 1 undefined on input li ne 14.
No file bib.bbl.
Package natbib Warning: There were undefined citations.
.bibfile located? Doesbibtexgive you errors? What editor are you using? – Alan Munn Aug 06 '18 at 01:21No file bib.bbl.
Package natbib Warning: There were undefined citations.
– mahsa rezaee Aug 06 '18 at 01:43.bibfile? Is it in the same folder as your.texfile? – Alan Munn Aug 06 '18 at 01:48.blgfile say? – Alan Munn Aug 06 '18 at 01:58.blgfile should be a log file created whenbibtexis run. It doesn't compile. Try adding the following:% !TEX TS-program = pdfLaTeXmkat the beginning of your file and recompiling. – Alan Munn Aug 06 '18 at 02:19bibtexthen? Try Command-T, (compile) Command-B, (bibtex) Command-T, (compile) Command-T (compile) in TeXShop. – Alan Munn Aug 06 '18 at 02:24