Re: Displaying block of code

2010-05-19 Thread Helge Hafting

Manveru wrote:



I would like to extend that question about listings to how may I
format a listing for the interactive command line session. I mean to
have commands typed by user in bold and everything else in normal,
with italicizing some keywords (I am thinking about Python now).



Listings can do some pretty-printing for you. Bring up the settings for 
your listing, and set the language to "Python". This should get you nice 
syntax highlighting - in the output, not in the LyX editor.


The automatic higlighting don't differentiate between user typed stuff 
and other stuff though. So you may have to use "bold" manually.


The rules for syntax higlighting _can_ be adapted, but that is only
worth the effort if you have lots of code to list.


Helge Hafting


Re: Displaying block of code

2010-05-18 Thread Manveru
2010/5/18 Paul A. Rubin :
> On 5/18/2010 5:23 AM, Artimess wrote:
>> [...] I like to know if there are
>> any commands that I can use to display block of codes and commands.  I
>> do not want to use the same font and style of ordinary text and I would
>> like to keep these code blocks together .  By that I mean I do not want
>> half the code in one page and the other have in another page.
>>
>
> You may want to use the LaTeX listings package (assuming you have it
> installed) to format the code.  Use Insert > Program Listing to create an
> inset where you type the code. Right click on the inset and use Settings ...
> to select various options such as font, color, computer language etc.
>
> To keep the code together, you can check the Float box in the main settings
> tab of the listing options.  For details, look at chapter 7 of the Embedded
> Objects manual (Help > Embedded Objects).

I would like to extend that question about listings to how may I
format a listing for the interactive command line session. I mean to
have commands typed by user in bold and everything else in normal,
with italicizing some keywords (I am thinking about Python now).

-- 
Manveru
jabber: manv...@manveru.pl
 gg: 1624001
   http://www.manveru.pl


Re: Displaying block of code

2010-05-18 Thread Paul A. Rubin

On 5/18/2010 5:23 AM, Artimess wrote:

Please for give me for this very simple minded question.


Best kind -- easy to answer. :-)


 I am new to
this  user group and Lyx for that matter.  I like to know if there are
any commands that I can use to display block of codes and commands.  I
do not want to use the same font and style of ordinary text and I would
like to keep these code blocks together .  By that I mean I do not want
half the code in one page and the other have in another page.



You may want to use the LaTeX listings package (assuming you have it 
installed) to format the code.  Use Insert > Program Listing to create 
an inset where you type the code. Right click on the inset and use 
Settings ... to select various options such as font, color, computer 
language etc.


To keep the code together, you can check the Float box in the main 
settings tab of the listing options.  For details, look at chapter 7 of 
the Embedded Objects manual (Help > Embedded Objects).


Cheers,
Paul



Displaying block of code

2010-05-18 Thread Artimess
Please for give me for this very simple minded question.  I am new to this
user group and Lyx for that matter.  I like to know if there are any
commands that I can use to display block of codes and commands.  I do not
want to use the same font and style of ordinary text and I would like to
keep these code blocks together .  By that I mean I do not want half the
code in one page and the other have in another page.

Many thanks in advance,
Artimess