Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

1 Answer

I just tried this with this minimal example:

\documentclass{article}

\usepackage{listings}

\begin{document}
  \lstinputlisting[language=Python]{/usr/bin/apt-mark}
\end{document}

(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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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