Hi group,

I sometimes need sourcecode examples in my documents. I already know, that
the LyX environment "Lyx-Code" must be used for that.

However, I haven't found a comfortable way to import sourcecode from an
existing ASCII-file without loosing all the formatting - i.e. the
indentation with blanks and/or tabs in front of each line and the line
breaks, which is crucial for the readability of sourcecode.

If I import as ASCII, all leading whitespace is removed, so the
indentation is gone.

If I cut & paste from an xterm using middle-mouse into Lyx-Code
environment, it doesn't honor the line-breaks.

The only way I've found so far is generating an ASCII sourcecode file with
LaTeX prefix and postfix and putting the sourcecode into LaTeX verbatim
environment. Then later in LyX, after importing that, mark the text in
verbatim box manually, copy it and paste it again into prepared Lyx-Code
environment outside the verbatim box.

Am I overlooking something or is this really *that* complicated?

Regards,

Guido

Reply via email to