I have a problem concerning the listings package in latex. I need to embed a source code of the following XML document http://www.sparxsystems.com.au/downloads/profiles/EP_Extensions.xml in my master thesis' appendix. The problem is, no matter what options I pass to the package, I don't seem to be able to fit it on the page. The lines in the listing are too long, and the listings package doesn't wrap them, which seems odd... What combination of options will do the trick?
At the moment I use the following lstset instruction:
\lstset{ breakindent=0em, language=XML, basicstyle=\footnotesize, numbers=left, numberstyle=\footnotesize, stepnumber=2, numbersep=5pt, backgroundcolor=\color{white}, showspaces=false, showstringspaces=false, showtabs=false, frame=single, tabsize=2, captionpos=b, breaklines=true, breakatwhitespace=true, breakautoindent=true, escapeinside={\%*}{*)}, linewidth=\textwidth }
Which, with no other options set, and combined with the following command:
\lstinputlisting{EP_Extensions.xml}
Lists the given file's source to the following output:
I just had this problem...
breaklines
worked for me, though you do need to set it to true - the default is false:
\lstinputlisting[style=Python, caption=My Class, label={mine.py}, breaklines=true, ]{../python/mine.py}
is pretty much what I used
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With