I am trying to use LyX to insert child document-listing-program. The program imports OK but it is too long to fit on a single page. At the bottom of the page it outputs over the margin, sometimes cutting characters in half, on the page it continues into it leaves the correct header gap. I have tried using LaTeX code \lstinputlisting[language=Python]{file.py} with the same result. Please help On a side note if you could let me know how to color format the code that would be great. From my reading it seems to imply that by using language = Python a keywords list will have been generated with some keyword styles predefined, but I don't know how to access these and use them to set further styles.

Can't even begin to explain how frustrating this has been trying to find out so any help would be massively appreciated.

closed as unclear what you're asking by jub0bs, T. Verron, Martin Schröder, Sean Allred, Marco Daniel Mar 2 '14 at 17:33

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.

  • 1
    Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – jub0bs Mar 2 '14 at 14:21

I just tried this with this minimal example:




(The given file was just the first longer python file I found on my system.)

This writes over the side margin, but not over the lower one, instead it does a proper page-break.

It could be that your page size settings are wrong, but without a minimal example of your problem this is difficult to diagnose.

Not the answer you're looking for? Browse other questions tagged or ask your own question.