Re: new lines disappearing in program listings
Daniel, Thanks for your post, it's helped me with the problem I've been having as well. I was trying to create a new environment that used the lstlisting latex environment. This was to be able to easily create consistent program listings (as well as making it easy for users who have no latex experience) and not having to use ERT. The other goal was to be able to get floating listings with captions/ labels. The big problem I was having was that lyx was inserting extra newlines in the output. My next thought was to hack the source of LyX to add an option for the layouts of 'IsVerbatim' to better support environments that are supposed to be verbatim environments. But I quickly found that I was out of my depth, as I couldn't even find where to start for this ;) If I don't find a solution to getting the layout method to work, at least your post has given me an acceptable workaround. Thanks again, Michael On Mar 5, 2008, at 1:39 AM, Daniel Lohmann wrote: On 05.03.2008, at 05:55, Bo Peng wrote: Have you checked out the support for lstlisting in LyX 1.5.x? I gather from the wiki that Bo Peng is responsible for it (props to Bo). It's not on the environment roster; you get it with Insert - Program Listing. Right click the widget handle to see all the controllable stuff. I know the mentioned problems with listings but they are not easy to solve. I also recommend using a listings child document for long listings. I have been using the listings package quite a lot. Since LyX 1.4 it works perfectly if used in ERT boxes (pre 1.4 versions added an extra new-line after every hard line break, which required some trickery with negative linkeskip values to yield a good result.) I never used the new listings inset, though. In my opinion, ERT boxes are just perfect for in-text listings of code. Listings clearly is one of the best documented packages available in the LaTeX world and has a very convenient interface, so hand coding listings options is not at all painful. All one should do is to define a listings style with all necessary default settings in the preamble (a good practice anyway). Then only two actual LaTeX lines have to be in each ERT box: \begin{lstlisting}[style=ac] #include Win32Error.h aspect ThrowWin32Errors { advice call( win32::Win32API() ) : after() { if( win32::IsError( *tjp-result() ) { throw win32::Exception(); } } }; \end{lstlisting} Keeping (short) listings in ERT boxes this way has a some clear advantages: - The on-screen formatting is easy, as within ERT a typewriter font is used. - The spell checker skips ERT boxes, hence the listings do not get spell checked (that always annoyed me with LyxCode) - Extra options can easily be passed as additional optional parameters in the square brackets. For longer listings I recommend to not input them as LyX child documents, but keep them in ordinary text files using the \lstinputlisting command in ERT: \lstinputlisting[style=aclisting]{../src/win32eh-app.cpp} Just my two cents, Daniel
Re: new lines disappearing in program listings
Daniel, Thanks for your post, it's helped me with the problem I've been having as well. I was trying to create a new environment that used the lstlisting latex environment. This was to be able to easily create consistent program listings (as well as making it easy for users who have no latex experience) and not having to use ERT. The other goal was to be able to get floating listings with captions/ labels. The big problem I was having was that lyx was inserting extra newlines in the output. My next thought was to hack the source of LyX to add an option for the layouts of 'IsVerbatim' to better support environments that are supposed to be verbatim environments. But I quickly found that I was out of my depth, as I couldn't even find where to start for this ;) If I don't find a solution to getting the layout method to work, at least your post has given me an acceptable workaround. Thanks again, Michael On Mar 5, 2008, at 1:39 AM, Daniel Lohmann wrote: On 05.03.2008, at 05:55, Bo Peng wrote: Have you checked out the support for lstlisting in LyX 1.5.x? I gather from the wiki that Bo Peng is responsible for it (props to Bo). It's not on the environment roster; you get it with Insert - Program Listing. Right click the widget handle to see all the controllable stuff. I know the mentioned problems with listings but they are not easy to solve. I also recommend using a listings child document for long listings. I have been using the listings package quite a lot. Since LyX 1.4 it works perfectly if used in ERT boxes (pre 1.4 versions added an extra new-line after every hard line break, which required some trickery with negative linkeskip values to yield a good result.) I never used the new listings inset, though. In my opinion, ERT boxes are just perfect for in-text listings of code. Listings clearly is one of the best documented packages available in the LaTeX world and has a very convenient interface, so hand coding listings options is not at all painful. All one should do is to define a listings style with all necessary default settings in the preamble (a good practice anyway). Then only two actual LaTeX lines have to be in each ERT box: \begin{lstlisting}[style=ac] #include Win32Error.h aspect ThrowWin32Errors { advice call( win32::Win32API() ) : after() { if( win32::IsError( *tjp-result() ) { throw win32::Exception(); } } }; \end{lstlisting} Keeping (short) listings in ERT boxes this way has a some clear advantages: - The on-screen formatting is easy, as within ERT a typewriter font is used. - The spell checker skips ERT boxes, hence the listings do not get spell checked (that always annoyed me with LyxCode) - Extra options can easily be passed as additional optional parameters in the square brackets. For longer listings I recommend to not input them as LyX child documents, but keep them in ordinary text files using the \lstinputlisting command in ERT: \lstinputlisting[style=aclisting]{../src/win32eh-app.cpp} Just my two cents, Daniel
Re: new lines disappearing in program listings
Daniel, Thanks for your post, it's helped me with the problem I've been having as well. I was trying to create a new environment that used the lstlisting latex environment. This was to be able to easily create consistent program listings (as well as making it easy for users who have no latex experience) and not having to use ERT. The other goal was to be able to get floating listings with captions/ labels. The big problem I was having was that lyx was inserting extra newlines in the output. My next thought was to hack the source of LyX to add an option for the layouts of 'IsVerbatim' to better support environments that are supposed to be verbatim environments. But I quickly found that I was out of my depth, as I couldn't even find where to start for this ;) If I don't find a solution to getting the layout method to work, at least your post has given me an acceptable workaround. Thanks again, Michael On Mar 5, 2008, at 1:39 AM, Daniel Lohmann wrote: On 05.03.2008, at 05:55, Bo Peng wrote: Have you checked out the support for lstlisting in LyX 1.5.x? I gather from the wiki that Bo Peng is responsible for it (props to Bo). It's not on the environment roster; you get it with Insert -> Program Listing. Right click the widget handle to see all the controllable stuff. I know the mentioned problems with listings but they are not easy to solve. I also recommend using a listings child document for long listings. I have been using the listings package quite a lot. Since LyX 1.4 it works perfectly if used in ERT boxes (pre 1.4 versions added an extra new-line after every hard line break, which required some trickery with negative linkeskip values to yield a good result.) I never used the new listings inset, though. In my opinion, ERT boxes are just perfect for in-text listings of code. Listings clearly is one of the best documented packages available in the LaTeX world and has a very convenient interface, so "hand coding" listings options is not at all painful. All one should do is to define a listings style with all necessary default settings in the preamble (a good practice anyway). Then only two actual LaTeX lines have to be in each ERT box: \begin{lstlisting}[style=ac] #include "Win32Error.h" aspect ThrowWin32Errors { advice call( win32::Win32API() ) : after() { if( win32::IsError( *tjp->result() ) { throw win32::Exception(); } } }; \end{lstlisting} Keeping (short) listings in ERT boxes this way has a some clear advantages: - The on-screen formatting is easy, as within ERT a typewriter font is used. - The spell checker skips ERT boxes, hence the listings do not get spell checked (that always annoyed me with LyxCode) - Extra options can easily be passed as additional optional parameters in the square brackets. For longer listings I recommend to not input them as LyX child documents, but keep them in ordinary text files using the \lstinputlisting command in ERT: \lstinputlisting[style=aclisting]{../src/win32eh-app.cpp} Just my two cents, Daniel
Re: new lines disappearing in program listings
Brian Guenter wrote: I'm new to Lyx and I'm hoping that the problems I'm encountering are just due to my ignorance. I have a large existing code base in my development environment which I am going to be copying into my Lyx document as program listings. I had an existing Latex document with program listings in it using the lstlisting environment. When I imported this document into Lyx all of the newlines in the program listings disappeared. Confirmed. Similarly, if I copy code from my development environment (Visual Studio 2008) and paste it into a program listing block in Lyx all of the newlines are discarded. Try Edit - Paste Special - Plain Text (C-S-V). This works for me (meaning the newlines are preserved). If I have a properly formatted program listing, with newlines, in a Lyx document and I export the Lyx document to a Latex file and then import the Latex file back into Lyx all of the newlines in program listing blocks disappear. Confirmed. It's terribly inconvenient and time-consuming to have to reinsert all of the newlines by hand and retyping the code in Lyx is also an unattractive option because I have so much of it and because this will certainly introduce transcription errors. Is this newline deletion a bug or is there something I can set to prevent the newlines from disappearing? It's a bug (or a lack of a feature, or a lag in implementing a feature). Support for the listings environment is relatively new to LyX. LyX uses a program called tex2lyx to convert LaTeX files to LyX file. My guess is that tex2lyx has not caught up to the implementation of the listings package, and it's tex2lyx that's eating the newlines. You might want to file a bug report against this. (I did a quick search and couldn't find one.) Also, if you run 'tex2lyx --help', you'll see a rather intriguing reference to the -s option: -s syntaxfile read additional syntax file. Assuming one can find some documentation on syntax files for tex2lyx (so far I can't), perhaps one can implement a modification to preserve newlines in listings that way. /Paul
Re: new lines disappearing in program listings
Paul A. Rubin wrote: I'm new to Lyx and I'm hoping that the problems I'm encountering are just due to my ignorance. I have a large existing code base in my development environment which I am going to be copying into my Lyx document as program listings. I had an existing Latex document with program listings in it using the lstlisting environment. When I imported this document into Lyx all of the newlines in the program listings disappeared. Confirmed. The listings inset has some deficiencies (it cannot handle tabs yet and it doesn't handle whitespace well in general). For such a case, I'd recommend to keep the listings in a text file and include them via Insert-File-Child Document, where you can chose Program Listing from the combo. Jürgen
Re: new lines disappearing in program listings
On Tuesday 04 March 2008 16:18, Juergen Spitzmueller wrote: Paul A. Rubin wrote: I'm new to Lyx and I'm hoping that the problems I'm encountering are just due to my ignorance. I have a large existing code base in my development environment which I am going to be copying into my Lyx document as program listings. I had an existing Latex document with program listings in it using the lstlisting environment. When I imported this document into Lyx all of the newlines in the program listings disappeared. Confirmed. The listings inset has some deficiencies (it cannot handle tabs yet and it doesn't handle whitespace well in general). For such a case, I'd recommend to keep the listings in a text file and include them via Insert-File-Child Document, where you can chose Program Listing from the combo. Why would one use the listings inset rather than just using the LyXCode environment? The former isn't easily visible in the LyX environment, the latter is. The former is ERT, the latter isn't. SteveT Steve Litt Books written in LyX: Troubleshooting Techniques of the Successful Technologist Twenty Eight Tales of Troubleshooting Troubleshooting: Just the Facts
Re: new lines disappearing in program listings
Steve Litt wrote: Why would one use the listings inset rather than just using the LyXCode environment? The former isn't easily visible in the LyX environment, the latter is. The former is ERT, the latter isn't. Listings has syntax highlighting for many languages, line count and many other useful features. Jürgen
Re: new lines disappearing in program listings
Steve Litt wrote: Why would one use the listings inset rather than just using the LyXCode environment? The former isn't easily visible in the LyX environment, the latter is. The former is ERT, the latter isn't. Have you checked out the support for lstlisting in LyX 1.5.x? I gather from the wiki that Bo Peng is responsible for it (props to Bo). It's not on the environment roster; you get it with Insert - Program Listing. Right click the widget handle to see all the controllable stuff. /Paul
Re: new lines disappearing in program listings
Have you checked out the support for lstlisting in LyX 1.5.x? I gather from the wiki that Bo Peng is responsible for it (props to Bo). It's not on the environment roster; you get it with Insert - Program Listing. Right click the widget handle to see all the controllable stuff. I know the mentioned problems with listings but they are not easy to solve. I also recommend using a listings child document for long listings. Cheers, Bo
Re: new lines disappearing in program listings
On 05.03.2008, at 05:55, Bo Peng wrote: Have you checked out the support for lstlisting in LyX 1.5.x? I gather from the wiki that Bo Peng is responsible for it (props to Bo). It's not on the environment roster; you get it with Insert - Program Listing. Right click the widget handle to see all the controllable stuff. I know the mentioned problems with listings but they are not easy to solve. I also recommend using a listings child document for long listings. I have been using the listings package quite a lot. Since LyX 1.4 it works perfectly if used in ERT boxes (pre 1.4 versions added an extra new-line after every hard line break, which required some trickery with negative linkeskip values to yield a good result.) I never used the new listings inset, though. In my opinion, ERT boxes are just perfect for in-text listings of code. Listings clearly is one of the best documented packages available in the LaTeX world and has a very convenient interface, so hand coding listings options is not at all painful. All one should do is to define a listings style with all necessary default settings in the preamble (a good practice anyway). Then only two actual LaTeX lines have to be in each ERT box: \begin{lstlisting}[style=ac] #include Win32Error.h aspect ThrowWin32Errors { advice call( win32::Win32API() ) : after() { if( win32::IsError( *tjp-result() ) { throw win32::Exception(); } } }; \end{lstlisting} Keeping (short) listings in ERT boxes this way has a some clear advantages: - The on-screen formatting is easy, as within ERT a typewriter font is used. - The spell checker skips ERT boxes, hence the listings do not get spell checked (that always annoyed me with LyxCode) - Extra options can easily be passed as additional optional parameters in the square brackets. For longer listings I recommend to not input them as LyX child documents, but keep them in ordinary text files using the \lstinputlisting command in ERT: \lstinputlisting[style=aclisting]{../src/win32eh-app.cpp} Just my two cents, Daniel
Re: new lines disappearing in program listings
Brian Guenter wrote: I'm new to Lyx and I'm hoping that the problems I'm encountering are just due to my ignorance. I have a large existing code base in my development environment which I am going to be copying into my Lyx document as program listings. I had an existing Latex document with program listings in it using the lstlisting environment. When I imported this document into Lyx all of the newlines in the program listings disappeared. Confirmed. Similarly, if I copy code from my development environment (Visual Studio 2008) and paste it into a program listing block in Lyx all of the newlines are discarded. Try Edit - Paste Special - Plain Text (C-S-V). This works for me (meaning the newlines are preserved). If I have a properly formatted program listing, with newlines, in a Lyx document and I export the Lyx document to a Latex file and then import the Latex file back into Lyx all of the newlines in program listing blocks disappear. Confirmed. It's terribly inconvenient and time-consuming to have to reinsert all of the newlines by hand and retyping the code in Lyx is also an unattractive option because I have so much of it and because this will certainly introduce transcription errors. Is this newline deletion a bug or is there something I can set to prevent the newlines from disappearing? It's a bug (or a lack of a feature, or a lag in implementing a feature). Support for the listings environment is relatively new to LyX. LyX uses a program called tex2lyx to convert LaTeX files to LyX file. My guess is that tex2lyx has not caught up to the implementation of the listings package, and it's tex2lyx that's eating the newlines. You might want to file a bug report against this. (I did a quick search and couldn't find one.) Also, if you run 'tex2lyx --help', you'll see a rather intriguing reference to the -s option: -s syntaxfile read additional syntax file. Assuming one can find some documentation on syntax files for tex2lyx (so far I can't), perhaps one can implement a modification to preserve newlines in listings that way. /Paul
Re: new lines disappearing in program listings
Paul A. Rubin wrote: I'm new to Lyx and I'm hoping that the problems I'm encountering are just due to my ignorance. I have a large existing code base in my development environment which I am going to be copying into my Lyx document as program listings. I had an existing Latex document with program listings in it using the lstlisting environment. When I imported this document into Lyx all of the newlines in the program listings disappeared. Confirmed. The listings inset has some deficiencies (it cannot handle tabs yet and it doesn't handle whitespace well in general). For such a case, I'd recommend to keep the listings in a text file and include them via Insert-File-Child Document, where you can chose Program Listing from the combo. Jürgen
Re: new lines disappearing in program listings
On Tuesday 04 March 2008 16:18, Juergen Spitzmueller wrote: Paul A. Rubin wrote: I'm new to Lyx and I'm hoping that the problems I'm encountering are just due to my ignorance. I have a large existing code base in my development environment which I am going to be copying into my Lyx document as program listings. I had an existing Latex document with program listings in it using the lstlisting environment. When I imported this document into Lyx all of the newlines in the program listings disappeared. Confirmed. The listings inset has some deficiencies (it cannot handle tabs yet and it doesn't handle whitespace well in general). For such a case, I'd recommend to keep the listings in a text file and include them via Insert-File-Child Document, where you can chose Program Listing from the combo. Why would one use the listings inset rather than just using the LyXCode environment? The former isn't easily visible in the LyX environment, the latter is. The former is ERT, the latter isn't. SteveT Steve Litt Books written in LyX: Troubleshooting Techniques of the Successful Technologist Twenty Eight Tales of Troubleshooting Troubleshooting: Just the Facts
Re: new lines disappearing in program listings
Steve Litt wrote: Why would one use the listings inset rather than just using the LyXCode environment? The former isn't easily visible in the LyX environment, the latter is. The former is ERT, the latter isn't. Listings has syntax highlighting for many languages, line count and many other useful features. Jürgen
Re: new lines disappearing in program listings
Steve Litt wrote: Why would one use the listings inset rather than just using the LyXCode environment? The former isn't easily visible in the LyX environment, the latter is. The former is ERT, the latter isn't. Have you checked out the support for lstlisting in LyX 1.5.x? I gather from the wiki that Bo Peng is responsible for it (props to Bo). It's not on the environment roster; you get it with Insert - Program Listing. Right click the widget handle to see all the controllable stuff. /Paul
Re: new lines disappearing in program listings
Have you checked out the support for lstlisting in LyX 1.5.x? I gather from the wiki that Bo Peng is responsible for it (props to Bo). It's not on the environment roster; you get it with Insert - Program Listing. Right click the widget handle to see all the controllable stuff. I know the mentioned problems with listings but they are not easy to solve. I also recommend using a listings child document for long listings. Cheers, Bo
Re: new lines disappearing in program listings
On 05.03.2008, at 05:55, Bo Peng wrote: Have you checked out the support for lstlisting in LyX 1.5.x? I gather from the wiki that Bo Peng is responsible for it (props to Bo). It's not on the environment roster; you get it with Insert - Program Listing. Right click the widget handle to see all the controllable stuff. I know the mentioned problems with listings but they are not easy to solve. I also recommend using a listings child document for long listings. I have been using the listings package quite a lot. Since LyX 1.4 it works perfectly if used in ERT boxes (pre 1.4 versions added an extra new-line after every hard line break, which required some trickery with negative linkeskip values to yield a good result.) I never used the new listings inset, though. In my opinion, ERT boxes are just perfect for in-text listings of code. Listings clearly is one of the best documented packages available in the LaTeX world and has a very convenient interface, so hand coding listings options is not at all painful. All one should do is to define a listings style with all necessary default settings in the preamble (a good practice anyway). Then only two actual LaTeX lines have to be in each ERT box: \begin{lstlisting}[style=ac] #include Win32Error.h aspect ThrowWin32Errors { advice call( win32::Win32API() ) : after() { if( win32::IsError( *tjp-result() ) { throw win32::Exception(); } } }; \end{lstlisting} Keeping (short) listings in ERT boxes this way has a some clear advantages: - The on-screen formatting is easy, as within ERT a typewriter font is used. - The spell checker skips ERT boxes, hence the listings do not get spell checked (that always annoyed me with LyxCode) - Extra options can easily be passed as additional optional parameters in the square brackets. For longer listings I recommend to not input them as LyX child documents, but keep them in ordinary text files using the \lstinputlisting command in ERT: \lstinputlisting[style=aclisting]{../src/win32eh-app.cpp} Just my two cents, Daniel
Re: new lines disappearing in program listings
Brian Guenter wrote: I'm new to Lyx and I'm hoping that the problems I'm encountering are just due to my ignorance. I have a large existing code base in my development environment which I am going to be copying into my Lyx document as program listings. I had an existing Latex document with program listings in it using the lstlisting environment. When I imported this document into Lyx all of the newlines in the program listings disappeared. Confirmed. Similarly, if I copy code from my development environment (Visual Studio 2008) and paste it into a program listing block in Lyx all of the newlines are discarded. Try Edit -> Paste Special -> Plain Text (C-S-V). This works for me (meaning the newlines are preserved). If I have a properly formatted program listing, with newlines, in a Lyx document and I export the Lyx document to a Latex file and then import the Latex file back into Lyx all of the newlines in program listing blocks disappear. Confirmed. It's terribly inconvenient and time-consuming to have to reinsert all of the newlines by hand and retyping the code in Lyx is also an unattractive option because I have so much of it and because this will certainly introduce transcription errors. Is this newline deletion a bug or is there something I can set to prevent the newlines from disappearing? It's a bug (or a lack of a feature, or a lag in implementing a feature). Support for the listings environment is relatively new to LyX. LyX uses a program called tex2lyx to convert LaTeX files to LyX file. My guess is that tex2lyx has not caught up to the implementation of the listings package, and it's tex2lyx that's eating the newlines. You might want to file a bug report against this. (I did a quick search and couldn't find one.) Also, if you run 'tex2lyx --help', you'll see a rather intriguing reference to the -s option: "-s syntaxfile read additional syntax file". Assuming one can find some documentation on syntax files for tex2lyx (so far I can't), perhaps one can implement a modification to preserve newlines in listings that way. /Paul
Re: new lines disappearing in program listings
Paul A. Rubin wrote: >> I'm new to Lyx and I'm hoping that the problems I'm encountering are >> just due to my ignorance. I have a large existing code base in my >> development environment which I am going to be copying into my Lyx >> document as program listings. I had an existing Latex document with >> program listings in it using the lstlisting environment. When I >> imported this document into Lyx all of the newlines in the program >> listings disappeared. > > Confirmed. The listings inset has some deficiencies (it cannot handle tabs yet and it doesn't handle whitespace well in general). For such a case, I'd recommend to keep the listings in a text file and include them via Insert->File->Child Document, where you can chose "Program Listing" from the combo. Jürgen
Re: new lines disappearing in program listings
On Tuesday 04 March 2008 16:18, Juergen Spitzmueller wrote: > Paul A. Rubin wrote: > >> I'm new to Lyx and I'm hoping that the problems I'm encountering are > >> just due to my ignorance. I have a large existing code base in my > >> development environment which I am going to be copying into my Lyx > >> document as program listings. I had an existing Latex document with > >> program listings in it using the lstlisting environment. When I > >> imported this document into Lyx all of the newlines in the program > >> listings disappeared. > > > > Confirmed. > > The listings inset has some deficiencies (it cannot handle tabs yet and it > doesn't handle whitespace well in general). For such a case, I'd recommend > to keep the listings in a text file and include them via > Insert->File->Child Document, where you can chose "Program Listing" from > the combo. Why would one use the listings inset rather than just using the LyXCode environment? The former isn't easily visible in the LyX environment, the latter is. The former is ERT, the latter isn't. SteveT Steve Litt Books written in LyX: Troubleshooting Techniques of the Successful Technologist Twenty Eight Tales of Troubleshooting Troubleshooting: Just the Facts
Re: new lines disappearing in program listings
Steve Litt wrote: > Why would one use the listings inset rather than just using the LyXCode > environment? The former isn't easily visible in the LyX environment, the > latter is. The former is ERT, the latter isn't. Listings has syntax highlighting for many languages, line count and many other useful features. Jürgen
Re: new lines disappearing in program listings
Steve Litt wrote: Why would one use the listings inset rather than just using the LyXCode environment? The former isn't easily visible in the LyX environment, the latter is. The former is ERT, the latter isn't. Have you checked out the support for lstlisting in LyX 1.5.x? I gather from the wiki that Bo Peng is responsible for it (props to Bo). It's not on the environment roster; you get it with Insert -> Program Listing. Right click the widget handle to see all the controllable stuff. /Paul
Re: new lines disappearing in program listings
> Have you checked out the support for lstlisting in LyX 1.5.x? I gather > from the wiki that Bo Peng is responsible for it (props to Bo). It's > not on the environment roster; you get it with Insert -> Program > Listing. Right click the widget handle to see all the controllable stuff. I know the mentioned problems with listings but they are not easy to solve. I also recommend using a listings child document for long listings. Cheers, Bo
Re: new lines disappearing in program listings
On 05.03.2008, at 05:55, Bo Peng wrote: Have you checked out the support for lstlisting in LyX 1.5.x? I gather from the wiki that Bo Peng is responsible for it (props to Bo). It's not on the environment roster; you get it with Insert -> Program Listing. Right click the widget handle to see all the controllable stuff. I know the mentioned problems with listings but they are not easy to solve. I also recommend using a listings child document for long listings. I have been using the listings package quite a lot. Since LyX 1.4 it works perfectly if used in ERT boxes (pre 1.4 versions added an extra new-line after every hard line break, which required some trickery with negative linkeskip values to yield a good result.) I never used the new listings inset, though. In my opinion, ERT boxes are just perfect for in-text listings of code. Listings clearly is one of the best documented packages available in the LaTeX world and has a very convenient interface, so "hand coding" listings options is not at all painful. All one should do is to define a listings style with all necessary default settings in the preamble (a good practice anyway). Then only two actual LaTeX lines have to be in each ERT box: \begin{lstlisting}[style=ac] #include "Win32Error.h" aspect ThrowWin32Errors { advice call( win32::Win32API() ) : after() { if( win32::IsError( *tjp->result() ) { throw win32::Exception(); } } }; \end{lstlisting} Keeping (short) listings in ERT boxes this way has a some clear advantages: - The on-screen formatting is easy, as within ERT a typewriter font is used. - The spell checker skips ERT boxes, hence the listings do not get spell checked (that always annoyed me with LyxCode) - Extra options can easily be passed as additional optional parameters in the square brackets. For longer listings I recommend to not input them as LyX child documents, but keep them in ordinary text files using the \lstinputlisting command in ERT: \lstinputlisting[style=aclisting]{../src/win32eh-app.cpp} Just my two cents, Daniel