TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm wondering if it's possible to use guillemets («») in a lstlisting block? I have seen some solutions for including it in the document, but none with the listings package.

share|improve this question
@lockstep: why the tag "punctuation"? – Herbert Feb 9 '12 at 19:37
@Herbert Guillemets are a kind of quotation mark, for which we normally use punctuation. Perhaps characters or symbols would have been appropriate as alternative tags. I have no strong opinion here, so feel free to revert my tag selection. – lockstep Feb 9 '12 at 19:45
up vote 9 down vote accepted
\lstset{literate={«}{{\flqq}}1 {»}{{\frqq}}1}

my «foo» and my «bar»


enter image description here

share|improve this answer
Works like a charm! Thank you! – navlelo Feb 10 '12 at 10:25
with xelatexyou can do a morecomment=[s]{«}{»} – Herbert Jul 10 '12 at 15:34
Which part of your answer was the crucial part? What's bera for? What does \lstset do? Why are there numbers? I could look the answers to these questions up, of course, but I think it's good style on SE sites not only to provide code, but to explain what's going on and why the answer given works. I'd love to see more explanations in your great answers! – doncherry Jul 10 '12 at 18:26

Your Answer


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.