title: How to add a (large) code appendix in LaTeX / LyX?
body: <p>I'd like to add a code appendix to my LyX document. There are a few options I already considered, but they all have their problems.</p>
  
  <p>I know a bit about listings, but one problem with those is that, if I copy &amp; paste my code into them, I lose all enters/newlines. Since the code is too large to correct by hand, I was wondering if there is an alternative.</p>
  
  <p>In LyX there is the possibility of inserting child documents, but that seems to be only for .tex files. Would have been ideal if I could just insert my .java file as a child document.</p>
  
  <p>I could print the code to PDF, but it will include margins that mess up the final document, since the PDF is placed on the left margin of the final document and <em>then</em> there is the margin of the PDF. Also, this PDF always contains the entire code and white areas where not the entire page has been filled.</p>
  
  <p>Does anyone have good alternative?</p>