My question is related to the following two
- How to have straight single quotes in lstlistings
- In the minted package, how do I enforce straight single quotes?
but I'm specifically asking about double-quote characters (ASCII decimal code 34).
They appear curly in my listings. How can I get straight double quotes instead?
MWE:
\documentclass{article}
\usepackage{textcomp,upquote,listings}
\lstset{upquote=true}
\begin{document}
\begin{lstlisting}
echo "Hello, world!"
\end{lstlisting}
\end{document}
produces
I understand that the upquote
package only applies to single quotes. How can I make it apply to double quotes as well?
Best Answer
Simply add
\usepackage[T1]{fontenc}
to your preamble. Note that you don't need theupquote
package if you loadtextcomp
and setlistings
'upquote
key totrue
.