How can I put code inside a math environment in LyX. For example, I want to insert a matrix, that is created via the "\tikzpicture" command, like in the first answer from here. But if I just copy the code from there and paste it into math mode, it turns to text - I don't seems to be able to insert evil red code in math mode. I can only type (which is tiring) some of the code hand, but can't insert text like "\" this automatically is converted from evil red code to a text backslash.
Is there any solution for this ? I would really like to have LyX display to me the matrices on the left and right, from the post of the link above, and have only the middle in evil red code.
(Of course I could just put everything in evil red code, including the math stuff, but then the left and right matrices would also be in code, which would be a pity).