[Tex/LaTex] How to use different lstset settings for listings


I would like to specify two different lstset settings in one latex file: one for java code, one for html. Is this somehow possible?

The solution of https://stackoverflow.com/questions/2654810/how-to-reset-lstset-settings-for-listings does not seem to be appropriate for my document because I have more than just one html listing.

Best Answer

Every lstlistings block can have its own formatting commands. So:






If you want to use two distinct listings and resetting the listings like this manually is a hassle, just create some new environments with lstnewenvironment for example:


page 42 of the listings manual has the details