[Tex/LaTex] Inserting caption for listings in LyX

captionslistingslyx

I'm using LyX 2.1.1 and want to put captions for listings. I can do this by using LaTeX code in ERT but would like to do by using LyX built-in capabilities of Insert > Program Listing. Any help will be highly appreciated.

Best Answer

First Insert->Program listing and then insert your code into the red box and then right mouse click with the mouse cursor inside the listing box. Choose preferences and then Extended. In the right frame you can insert for example "caption={my caption}".