Problem with printing of cases statement on overview

I just noticed that this question has some printing issues on the overview page that has to do with a \begin{cases} statement.

• Unless it has been changed, the reason is that the code for the preview grabs the first $n$ characters of the post. That of course provides ample opportunities to get broken MathJax code for the preview. – Daniel Fischer Feb 20 '16 at 19:06
• @DanielFischer But the strange looking box shouldn't be desirable, I think. – Martijn Feb 20 '16 at 19:09
• This seems related. I think we have a question about the excerpt preview with an answer, but I haven't found it yet. – Daniel Fischer Feb 20 '16 at 19:11
• Also this, which links to this. These are about search results, but it's probably the same code. – Daniel Fischer Feb 20 '16 at 19:16

$f_{XY}(x,y) = \begin{cases} 2e^{-y} & \text{if$-y< x < y$and 0 < y < } \infty .\\ 0 & ... I edited it to remove formula-text-formula nesting: \text{if } -y< x < y \ \text{ and }\ 0 < y < \infty Now the preview has plain unrendered formula, since there is no$ for MathJax to interpret as the closing delimiter.
Part of a problem is having symmetric delimiters $...$, which was not the best idea for TeX... Today one is advised to use  in LaTeX documents but this doesn't work well here due to escaping and over-escaping.