# Spoiler-markup broken for multilined display math? [duplicate]

A brief search didn't turn out a dupe, but recently I have found that the spoiler-markup >! doesn't work well with multilined MathJax, especially displaystyle:

>! $$\begin{pmatrix}1&2\\ 3&4\end{pmatrix}$$


! $$\begin{pmatrix}1&2\\ 3&4\end{pmatrix}$$

>! $$\begin{pmatrix}1&2\\ >! 3&4\end{pmatrix}$$


! $$\begin{pmatrix}1&2\\ >! 3&4\end{pmatrix}$$

How can this be fixed other than putting all the MathJax in a single line wich can be very bad for long code? Also note that the centering of $$...$$ isn't working in spoilers either during preview.

>! $$\begin{pmatrix}1&2\\3&4\end{pmatrix}$$


$$\begin{pmatrix}1&2\\3&4\end{pmatrix}$$

• You might find some posts mentioning similar problems if you have a look at other posts tagged (spoilers). From example this two posts seem related: meta.math.stackexchange.com/questions/10906/…, meta.math.stackexchange.com/questions/9297/… (In both cases some environment, which contained \, was used.) – Martin Sleziak Mar 7 '15 at 13:01
• Why do you need spoilers? – quid Mar 7 '15 at 13:06
• @quid Mostly for pedagogic purposes: Leave the option for the interested asker to run through the described process himself and compare his results to the actual solutions in a spoiler. I rarely employ them (wich you might know), but there are times where I find those useful. – AlexR Mar 7 '15 at 13:33
• Thanks for the reply. I did not know how much you use them. I am glad to hear you only use them rarely, as generally I consider them to be a nuissance on this site. Most of the time I think an asker that wishes to can run the process themselves even when the result was visible to them briefly. – quid Mar 7 '15 at 14:14
• @quid Generally I fully agree with you, wich is why I use them very rarely. But if the solution is a very interesting one, knowing it might "bias" the mathematical intuition towards the solution, sometimes preventing mistakes one would have made had one not known the solution. (Much grammatic, very wow) – AlexR Mar 7 '15 at 14:17
• Right. But then typically that solution would be short, else one could not even grasp it quickly. So for multiline-spoilers this seem exceedingly rarely an issue. But I guess by this point I insist too much on this. Sorry for the noise. I just really dislike spoilers on this site. – quid Mar 7 '15 at 14:24
• No problem, but matrices for example (as shown above) are barely readable if put into one line even if only one line of math is rendered. – AlexR Mar 7 '15 at 14:26
• In case you're not aware, there's an environment smallmatrix for... small matrices. You need to add the brackets yourself, but they look a bit better (I think) in inline math. – Najib Idrissi Mar 7 '15 at 15:11
• @NajibIdrissi I'm aware, thanks. Still their code as a one-liner is barely readable for larger matrices (or more complicated cells). I'm also aware of the shorthand \pmatrix{...} wich will improve readability at least a little when in one line. – AlexR Mar 7 '15 at 15:13
• IMHO, the spoiler on math.SE is so hard to use and I'll just forget it. $$\newcommand{\myspoiler}[2][padding: 4px;]{ \style{background-color: rgb(240,240,240);#1}{\class{spoiler}{#2}}} \verb/Your matrix is hiding here/ \rightarrow \myspoiler[padding: 8px;]{ \begin{pmatrix}1&2\\3&4\end{pmatrix} }$$ – achille hui Mar 7 '15 at 15:38
• @achillehui While nice and working, I think that format disrupts the UI too much. – AlexR Mar 7 '15 at 15:40