Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

So I am writing a book on AWK and when using listings code highlighting module, I get the fancy quotes “ ” and ‘ ’ instead of the regular ASCII ones " " and ' '. I hate these fancy quotes because when copying code examples from a PDF, they never work in the terminal.

Does anyone know how to make all code examples use only ASCII quotes?

I found out that you can set \lstset{upquote=true} and that fixes the single quotes ' ' but the double ones are still broken.

Any ideas?

share|improve this question

1 Answer 1

up vote 8 down vote accepted

Use a sensible fontencoding. And make a complete example next time so that nobody has to guess what you are doing wrong.

\documentclass{article}
\usepackage{listings}
\usepackage[T1]{fontenc}
\begin{document}

\begin{lstlisting}
"a"
\end{lstlisting}
\end{document}

Btw: Don't rely to much on copying code from a pdf. Spaces can disappear.

share|improve this answer
    
Perfect! \usepackage[T1]{fontenc} did it. –  Peteris Krumins Apr 30 '11 at 11:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.