How to use the environment defined by \lstnewenvironment in LyX

Paul A. Rubin parubin73 at gmail.com
Wed Nov 24 22:29:43 UTC 2021


On 11/24/21 2:00 AM, Guofeng Zhang wrote:
> Hi,
>
> I have created the new listing environment and use it in LyX by Tex 
> Code well.Is there any way that I could configure LyX (for example,  
> LyX's Programming Listings) to use this listing environment?
>
> Searched by google, but no way to go , so I tried to create a LyX 
> inset to use it. So another question: can I define an inset that 
> always has full line width in the editor?
>
> Thanks for your help!
>
> Guofeng
>
I'm not sure this will help, but I have a couple of LyX modules in 
GitHub repositories that might give you some ideas.

The simpler module is "pseudolst" (https://github.com/prubin73/pseudolst 
<https://github.com/prubin73/pseudolst>). It adds some pseudocode 
capabilities by tweaking the standard LyX "listing" environment, 
effectively adding a new language for listings.

The more complex module is "pseudocode" 
(https://github.com/prubin73/algpseudocode 
<https://github.com/prubin73/algpseudocode>), which adds support for the 
algpseudocode style in the algorithmx LaTeX package. It provides new LyX 
paragraph styles for a gaggle of pseudocode commands. It could be that 
mimicking something like this but with one new style would be all you 
would need.

Both come with a LyX file containing instructions and demo code. To view 
the LyX files properly, you would need to install the required LaTeX 
package (listings.sty for the first, algorithmx for the second) if you 
don't already have it, install the module in your local modules 
directory, then reconfigure LyX. Before doing that, though, you might 
want to download the compiled versions of the documents (PDF files, one 
in each repo) and see if they resonate with you.

Paul

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20211124/80f2691c/attachment.html>


More information about the lyx-users mailing list