+5  A: 

I see in the documentation (which should have been distributed with the packge, but is available at http://www.ctan.org/tex-archive/macros/latex/contrib/listings/listings.pdf) for listings that there is a settable property called upquote to take care of this.

From the documentation:

upquote=⟨true|false⟩                                                false
  determines whether the left and right quote are printed ‘’ or `'. This 
  key requires the textcomp package if true.

Do something like

\lstset{upquote=true}

before begining the list environment, or use

\begin{lstlisting}[upquote=true]
...
\end{lstlisting}


It is also possible that tis property is already set for you in the appropriate language definition (see the docs again, big list of predefined languages on page 12).

Use:

\lstloadlanguages{<dialects you need>}

in the header. And then set the language using either of the above conventions for choosing options.

dmckee
This looked promising, but unfortunately it didn't work when I tried it. The curly quotes still appear for me on Linux and Windows with Miktex of I set upquote to true. Setting it to false didn't work either.
Paul Vincent Craven
That's what I get for just skimming the docs. ChrisN seems to have the right property, but I would encourage you to use the predefined languages if one is appropriate. And, do read the docs, it is all in there. Cheers.
dmckee
I do use the predefined language in my actual work. I stripped out a lot of what I am doing to make the example minimal. That PDF is a good resource, but searching through it I still didn't find the answer. Thanks though.
Paul Vincent Craven
+2  A: 

dmckee's answer above probably works. If you drop your last condition, i.e. you permit changes to the code, then there is a more generic solution, which I tend to use whenever (La)TeX renders a character somehow differently than I expect it to do is to use the \symbol command. I list it here because it can be useful in other situations as well:

\newcommand{\qq}{\symbol{34}} % 34 is the decimal ascii code for "

And then your example:

\begin{lstlisting}
...
print{\qq}The temperature is{\qq},Celsius,{\qq}degrees Celsius{\qq}
...
\end{lstlisting}

Note the curly braces which supposedly take listings back to LaTeX mode (see escapechars option of the package.)

David Hanak
This worked for me, thanks!
Paul Vincent Craven
+3  A: 

Have you considered using a monospaced (typewriter) font for the listing? The following example works:

\documentclass{article}
\usepackage{listings}
\lstset{basicstyle=\ttfamily} % <<< This line added
\begin{document}
\begin{lstlisting}
Fahrenheit=input("What is the Fahrenheit temperature?")
Celsius=(5.0/9.0)*(Fahrenheit-32)
print"The temperature is",Celsius,"degrees Celsius"
\end{lstlisting}
\end{document}
ChrisN
Using \ttfamily in the basic style works great for me too, although it causes me to loose the styling provided by the listing package for my language (such as bolding keywords). Any thoughts besides re-defining the language style?
jasonb
A: 

Maybe it's because I installed listings early as a LaTeX user, but I'm surprised to learn that without the listings package the behaviour is any different.

My solution was similar to David Hanak's, but I used the symbols for double-quote as described in the LaTeX Cheat Sheet (http://stdout.org/~winston/latex)

\newcommand{\QQ}[1]{``#1''}
SmileAndNod
A: 

Here is a solution

\usepackage[T1]{fontenc}  
\usepackage{textcomp}  
\usepackage{lmodern}  

% in the listings package configuration, try:  
literate={"}{\textquotedbl}1,  
bugur