I am writing a document in which I have to put chunks of code. I would like to put these in red in a box with a grey background. The following code does what I want:
Because I am going to use this many times, I wanted to put this in a newenvironment that I could call when needed. Despite many attempts, I have not been able to do that so far. My knowledge in Latex is limited and I was wondering whether somebody could explain me how to do that.