# How To Hide An Array on MathSE

I constructed a (long) self-answer, that I subsequently discarded, since I found that the question + answer was a duplicate. I intended to have the answer hidden.

I had trouble converting the following array to a hidden format:

$$\begin{array}{| r | r | r | r |} \hline \text{Case} & n & n+1 & 2n+1 \\ \hline 1 & 2a^2 & 3b^2 & c^2 \\ \hline 2 & 2a^2 & b^2 & 3c^2 \\ \hline 3 & a^2 & 2b^2 & 3c^2 \\ \hline 4 & 3a^2 & 2b^2 & c^2 \\ \hline 5 & 6a^2 & b^2 & c^2 \\ \hline 6 & a^2 & 6b^2 & c^2 \\ \hline \end{array}$$

What I settled for is this:

-------------------------------------------- ----------
Case $$~~~~~~~n$$ $$~~~~~~~~n+1$$ $$~~~~~~2n+1$$
-------------------------------------------- ----------
$$~~~~1$$ $$~~~~~~2a^2$$ $$~~~~~~~~~~3b^2$$ $$~~~~~~~~~~~~~c^2$$
-------------------------------------------- ----------
$$~~~~2$$ $$~~~~~~2a^2$$ $$~~~~~~~~~~~b^2$$ $$~~~~~~~~~~~~3c^2$$
-------------------------------------------- ----------
$$~~~~3$$ $$~~~~~~~a^2$$ $$~~~~~~~~~~2b^2$$ $$~~~~~~~~~~~~3c^2$$
-------------------------------------------- ----------
$$~~~~4$$ $$~~~~~~3a^2$$ $$~~~~~~~~~~2b^2$$ $$~~~~~~~~~~~~~c^2$$
-------------------------------------------- ----------
$$~~~~5$$ $$~~~~~~6a^2$$ $$~~~~~~~~~~~b^2$$ $$~~~~~~~~~~~~~c^2$$
-------------------------------------------- ----------
$$~~~~6$$ $$~~~~~~~a^2$$ $$~~~~~~~~~~6b^2$$ $$~~~~~~~~~~~~~c^2$$
-------------------------------------------- ----------

You can review the code that I used by pretending to edit the question.

Questions:

1. At the present time, on mathSE, is this the best that I can do?
2. If so, how much trouble would it be for a moderator to enhance the html or mathJax capabilities at mathSE to facilitate including tabular/array of data in a hidden answer?
• An idea would be to use tables, but it seems that tables don't work in spoilers. Commented Jun 6, 2021 at 9:35

Here is a community answer for purposes of testing.

The text from the question posted as a spoiler.

! $$\begin{array}{| r | r | r | r |} \hline >! \text{Case} & n & n+1 & 2n+1 \\ \hline >! 1 & 2a^2 & 3b^2 & c^2 \\ \hline >! 2 & 2a^2 & b^2 & 3c^2 \\ \hline >! 3 & a^2 & 2b^2 & 3c^2 \\ \hline >! 4 & 3a^2 & 2b^2 & c^2 \\ \hline >! 5 & 6a^2 & b^2 & c^2 \\ \hline >! 6 & a^2 & 6b^2 & c^2 \\ \hline >! \end{array}$$

The same text, but now in a single line as suggested in: Multiline hidden text with align environment.

$$\begin{array}{| r | r | r | r |} \hline \text{Case} & n & n+1 & 2n+1 \\ \hline 1 & 2a^2 & 3b^2 & c^2 \\ \hline 2 & 2a^2 & b^2 & 3c^2 \\ \hline 3 & a^2 & 2b^2 & 3c^2 \\ \hline 4 & 3a^2 & 2b^2 & c^2 \\ \hline 5 & 6a^2 & b^2 & c^2 \\ \hline 6 & a^2 & 6b^2 & c^2 \\ \hline\end{array}$$

One might be tempted to try a table:

Case $$n$$ $$n+1$$ $$2n+1$$
$$1$$ $$2a^2$$ $$3b^2$$ $$c^2$$
$$2$$ $$2a^2$$ $$b^2$$ $$3c^2$$
$$3$$ $$a^2$$ $$2b^2$$ $$3c^2$$
$$4$$ $$3a^2$$ $$2b^2$$ $$c^2$$
$$5$$ $$6a^2$$ $$b^2$$ $$c^2$$
$$6$$ $$a^2$$ $$6b^2$$ $$c^2$$

But the tables do not work in spoilers:

| Case | $$n$$ | $$n+1$$ | $$2n+1$$ | |------|---|---|---| | $$1$$ | $$2a^2$$ | $$3b^2$$ | $$c^2$$ | | $$2$$ | $$2a^2$$ | $$b^2$$ | $$3c^2$$ | | $$3$$ | $$a^2$$ | $$2b^2$$ | $$3c^2$$ | | $$4$$ | $$3a^2$$ | $$2b^2$$ | $$c^2$$ | | $$5$$ | $$6a^2$$ | $$b^2$$ | $$c^2$$ | | $$6$$ | $$a^2$$ | $$6b^2$$ | $$c^2$$ |

From this answer of achille hui:

$$\require{action} \toggle{ \text{(Click to show table)} }{ \begin{array}{c} \begin{array}{| r | r | r | r |} \hline \text{Case} & n & n+1 & 2n+1 \\ \hline 1 & 2a^2 & 3b^2 & c^2 \\ \hline 2 & 2a^2 & b^2 & 3c^2 \\ \hline 3 & a^2 & 2b^2 & 3c^2 \\ \hline 4 & 3a^2 & 2b^2 & c^2 \\ \hline 5 & 6a^2 & b^2 & c^2 \\ \hline 6 & a^2 & 6b^2 & c^2 \\ \hline\end{array}\\ \text{(Click to hide table)} \end{array} } \endtoggle$$

• Nice trick. However I am used to writing arrays in multi-line.
– Paramanand Singh Mod
Commented Jun 6, 2021 at 9:42
• So you're saying that you can't spoil a table? Or that tables are already spoiled?
– Asaf Karagila Mod
Commented Jun 6, 2021 at 10:10
• +1 and accepted. Sharp answer. Commented Jun 6, 2021 at 10:27
• I will stress that this was intended as a space where various users can test their ideas how to do this. (That's why I made the answer CW.) So if you have some other ideas, do not hesitate to edit this further. Commented Jun 6, 2021 at 10:28
• @user2661923 I adapted a legendary answer of achille hui Commented Jun 6, 2021 at 11:11