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.

I'm seeing an odd character like a very flat U, where there should be a space, with the listings package. See example below. Does anyone have any idea why this is happening, or how to get rid or work around it?

\documentclass{standalone}
\usepackage{underscore}
\usepackage{listings}
\usepackage[usenames,dvipsnames, rgb, svgnames, x11names]{xcolor}
% Text layout
\topmargin 0.0cm
\oddsidemargin 0.5cm
\evensidemargin 0.5cm
\textwidth 16cm
\textheight 21cm 
\lstnewenvironment{cmd}[1][]{%
  \lstset{language=sh, backgroundcolor=\color{LightSteelBlue1}, #1}}
{}

\begin{document}
\begin{cmd}[caption=Configuration file section including filters]
[affy6]
[...]
    [[hapmap]]
    phenofiles = "data/Hapmap6.0/Pheno/hapmappheno_909.csv",
    genofile = "/data/snppy/Hapmap6.0/Geno/birdseed-v2.calls.txt"
    anno_filter = "chromosome = 5"
    idlink_filter = "studyid = 'CEU'"
    some_other_stuff = "foo = bar"
\end{cmd}
\end{document}

picture of the output

share|improve this question
    
Please try to load \usepackage[T1]{fontenc} and maybe the font berano or so –  Marco Daniel May 3 '12 at 6:18
    
@MarcoDaniel: Why? –  Faheem Mitha May 3 '12 at 14:38
add comment

1 Answer

up vote 5 down vote accepted

By default, listings shows spaces as a "squat-u" as part of strings (between quotes). Add the option showstringspaces=false to your list of \lstset options to remove this.

enter image description here

share|improve this answer
    
Wow, thanks Werner. I just assumed this was a bug, and didn't look at the manual, which states this behavior clearly. But why on earth would anyone want this as a default? –  Faheem Mitha May 3 '12 at 6:43
    
@FaheemMitha: In terms of programming, code sometimes have whitespace for readability. However, in terms of strings (typically used to produce output or assigned to variables), it may be very important if you use one or two spaces, say. TeX is similar in the sense that it gobbles spaces in code as needed, but not with string comparisons. For example: \def\strA{this that}\def\strB{this that}\ifx\strA\strB true\else false\fi will yield false, while \strA and \strB will typeset exactly the same in the output. –  Werner May 3 '12 at 14:06
    
Ok, I see. Thanks for the explanation. –  Faheem Mitha May 3 '12 at 14:38
add comment

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.