Following this question I was able to insert (Java) code into my lyx document. However, when I try to visualize (export it as a .pdf) the following error comes up:

I can't work with sizes bigger than about 19 feet. Continue and I'll use the largest value I can.

The related questions I found, this one and this one are related to including images into a document. Why does lyx show the same error when working with code snippets?

The issue appears in the following case:

long code 1

The error message:

long code 2

A shortened example can be found here

  • 1
    Can you please post a minimal example? see wiki.lyx.org/FAQ/MinimalExample
    – scottkosty
    Jan 18, 2016 at 17:54
  • I actually found out why. When copy/pasting from Intellij the white spaces are discarded and the code appears to lyx to be a very long string that it doesn't like.
    – Sebi
    Jan 18, 2016 at 18:12
  • @scottkosty No, I was wrong, I'm updating the question. I cannot really post a minimal example since the error occurs when the code to be inserted is of a certain length.
    – Sebi
    Jan 18, 2016 at 18:21
  • I see. Are you able to upload an example to dropbox or google drive or somewhere else?
    – scottkosty
    Jan 18, 2016 at 18:24
  • 1
    OK please add an answer to this question and accept it. Glad you got it figured out!
    – scottkosty
    Jan 18, 2016 at 20:41

1 Answer 1


I've managed to fix it by splitting all lines of code with new lines (when copied from intellij all '\n' characters have been removed and this cause a problem as the source was too long). Then, by right clicking the source code("Program listing") and going to the "Settings" I've changed the following:

  • in the Style menu box picked smallest font type (not tiny)
  • changed the family type to "Roman"
  • checked the break long lines box

It is important that each line has no more than 100 characters, otherwise when converting to .pdf (luatex) the lines might not fit within the pages of the exported .pdf.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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