[Tex/LaTex] Minus sign missing in lstinputlisting

listings

I am writing a report on ShareLaTeX and when I use lstinputlisting it renders some of my minus signs but not all.

I include my listing with:

\lstinputlisting[label=script:theory,caption={Calculating the expected
proportion of the genome covered by N
reads},language=R]{scripts/theory.R}

in scripts/theory.R I have:

G <- 1000 L <- 50 theoretic_proportion_of_genome_covered =
function(N){   a= N*L/(G-L)   1−exp(−a) }

And it renders like this:

enter image description here

As you can see, the first minus sign shows just fine but the next ones don't. It also has some weird spacings.

I have the following lstset:

\lstset{    language=R,                       
basicstyle=\footnotesize\ttfamily, numbers=left,
stepnumber=5,                    
numbersep=5pt, backgroundcolor=\color{white}, frame=single,           
captionpos=b,                        keywordstyle=\color{blue},
commentstyle=\color{green}     }

and my imports:

\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{listings}
\usepackage{color}
\usepackage{appendix}

I already looked at the following pages but none of them relieved me:

Best Answer

Using minus or dash characters did not work for me. But changing the font did. I added \lstset{basicstyle=\ttfamily} to the preamble and it worked fine.

Related Question