Take the 2-minute tour ×

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.

share|improve this question
add comment

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


1 Answer

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.

share|improve this answer
add comment
