# Why does Listings package not display anything?

I'm writing a C++ course for secondary students and wanted to display some source code in a nice way (indenting, eventually coloration) and tried the Listings package. But I have a problem, the file compile with no problem and then, when I look at the place where my code is supposed to appear, it is empty. Neither code or spaces. Why? I am not really a LaTex expert, I just wrote my thesis with it (no source code in it), so maybe it is something very simple I missed... Working on a mac with texmaker in utf8.

Thanks for your help Lucas

-
You should post a minimal example of the code that you're trying to compile. –  Juan A. Navarro Jan 20 '11 at 15:06

listings.sty can not handle utf8-characters. If this is your problem use listingsutf8 or alternetively package minted. If this is not an answer to your problem, then as usual: provide a small minimal example ...

-
Thank you very much! That was the problem... I always get problems when I want to use utf8... I will stick to latin1 now :) –  Lucas Jan 20 '11 at 15:28
Oops. I answered too early... In fact it does work with the snippet, but not with the code section or inclusion... –  Lucas Jan 20 '11 at 17:24
\documentclass[11pt,a4paper,draft]{article} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{array} \usepackage{listings} \begin{document} \section{Snippet} \lstset{language=C++} \lstinline!void main() {return 0}! \section{section} \lstset{language=C++} \begin{lstlisting}[frame=single] void main() { return 0; } \end{lstlisting} \section{include} \lstinputlisting{ex_comments.cpp} \end{document} –  Lucas Jan 20 '11 at 17:30
@Lucas: do not use the option draft in the documentclass –  Herbert Jan 20 '11 at 20:18
Ohhh... This time it works perfectly! That happens when you try to use commands you don't know, supposing which is the effect... Anyway, thank you very much! Lucas –  Lucas Jan 22 '11 at 8:03
\documentclass[11pt,a4paper,draft]{article}