# Problems using listings package [closed]

I'm using the listings package to include some source code files in a LaTeX document.

I'm having 2 problems:

1. characters - are not shown in the resulting file
2. characters % are shown overlapped with characters that appear after it.

This is my lstset:

\lstset{
showstringspaces=false,
extendedchars=true,
frameround=fttt,
frame=single,
upquote=true,
breaklines=true
}


And this is how I insert listings:

\begin{figure}[t]
{\small{
\lstinputlisting[language=Python,numbers=left, numberstyle=\tiny]{modProblem.txt}
\caption{\label{fig:modProblem} El problema del operador \%}
}}
\end{figure}

-

## closed as unclear what you're asking by Jubobs, Charles Stewart, Svend Tveskæg, Peter Jansson, OSjerickJan 15 '14 at 21:01

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Please provide a minimal working example. Moreover the command \lstinputlisting has the option caption. –  Marco Daniel Jun 16 '12 at 17:24
Welcome to TeX.SE. While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. In this case it will actually help to ensure that the solution actually solves your specific problem. –  Peter Grill Jun 16 '12 at 18:48

Tried to make you MWE:

\documentclass{article}
\usepackage{listings}
\usepackage{textcomp}

\lstset{
showstringspaces=false,
extendedchars=true,
frameround=fttt,
frame=single,
upquote=true,
breaklines=true
}

\begin{document}
\lstinputlisting[caption=El problema del operador \%  resuelto,language=Python,numbers=left, numberstyle=\small]{primes.py}
\end{document}


It produces normal output (on Windows, using both pdfLaTeX and XeLaTeX on TexWorks):

Only thing that needed to be added was \usepackage{textcomp} in order to use upquote=true,.

-