[Tex/LaTex] No dash between page range in natbib

bibliographiesbibtexnatbibsharelatex

The articles and books I reference to in my master's thesis are missing the "-" sign between the page numbers, so instead of "20-22" the result becomes "20 22" in the PDF-file. I use a bibtex database for all my references and apalike bibliography style.

My project is written in ShareLatex.

Please see the example below.

\documentclass[11pt,letter]{article}
\usepackage{hyperref}

\usepackage[authoryear]{natbib}
\setcitestyle{square}

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
    @ARTICLE{Illy,
    author = {E. Illy},
    title = {{The Complexity of Coffee}},
    journal = {Scientific American},
    month = {June},
    year = {2002},
    pages = {86--91}}
\end{filecontents*}

\begin{document}

Some existing text \citep{Illy}

\bibliography{\jobname}
\bibliographystyle{apalike}

% In the reference list the article should be represented like this:
Illy, E. (2002). The Complexity of Coffee. Scientific American, pages 86–91

% BUT the result look like this:
Illy, E. (2002). The Complexity of Coffee. Scientific American, pages 86 91

\end{document}

Can anybody help?

Best Answer

Your file runs properly with me, so there two possible explanations:

  • As suggested by @barbara beeton you have problems with the "dash" unicode characters, see related post.
  • You are not compiling the document correctly. As mentioned in the comments, run:

pdflatex file.tex

bibtex file.aux

pdflatex file.tex

pdflatex file.tex

And the output should look like this:

final output

Related Question