Thanks for the tip.
However, I have some questions.
Using Insert->Program Listing is great if you only need one or two
listings but keeping consistency throughout a large document is a pain.
So I decided to try and create a new layout using the listings
package, but I'm getting some unwanted newlines in my output.
I have this in my layout file:
Style CodeBlock
LatexType Environment
LatexName lstlisting
OptionalArgs 0
InTitle 0
Margin Static
NextNoIndent 0
ParIndent MMMM
Newline 0
PassThru 1
FreeSpacing 1
End
(I added the Newline, PassThru, and FreeSpacing options as
experimentation to try to get the spurious newlines eaten, to no
effect but I left them in this listing in the
interest of full disclosure ;)
If I give input in lyx (using the CodeBlock environment above) of:
some line of code 1
some line of code 2
some line of code 3
I get output such as:
some line of code 1
some line of code 2
some line of code 3
However, when I use the Insert->Program Listing option, it generates
the exact same latex code as my environment, except that I don't get
all the extra newlines.
So my question is how do I get LyX to not pass those extra newlines
and behave with the environment similar to the Inset?
On Feb 26, 2008, at 9:16 AM, Jürgen Spitzmüller wrote:
Michael Grubb wrote:
First these are the features that I'm really interested in (or
alternatives/compromises to these):
Ability to have short code/command examples in-line with normal text,
preferably set off with a monospaced font.
Ability to have longer code/command examples in a verbatim
environment
(possible surrounded by a box and a shaded background)
Ability to have longer code/command examples labled and indexed
(similar to figures and tables)
As of 1.5.0, LyX supports the listings package. It has both an
inline and a
displayed listings "inset" which should provide what you're looking
for.
Jürgen