Any way to hide part of an answer?

I've noticed that some of my answers, especially when doing mathy latex stuff, tend to get rather unwieldy and long. Is there any way to make certain sections hide and only be revealed if the user clicks on that section?

I'm thinking something like the hide tag for spoiler on some forums hides some text (and does NOT take up space) until you click on it.

Stack Exchange currently doesn't have a way to do this, but we should ask for it (which you did by tagging this as a feature request; thanks).

We should not think of this as a math-specific problem; other sites that don't use math also have long explanations sometimes, and it would be great to have a way to collapse/expand designated sections inline -- not with another page load, not with a mouse hover a la spoilers, and not by disrupting the flow of the answer, but by having a toggle bound to a section of an answer designated in the markdown.

A blogging platform that does this well is Dreamwidth, just as an example. The source for an entry can include "cut" tags, which mark the beginning and end of the section and also specify the text to include in the main page (defaults to "read more").

I don't think such a feature exists. You can in theory use spoiler block quotes, which are hidden by default until the user mouse overs them (I'm not sure how they interact on clients that don't have hover states), but they still take up vertical in the post and if you ask me should not be used except for material the person reading the answer is going to want to make a conscious decision to display. That does not include math, so I would very strongly discourage using those just to hide "mathy stuff". That's not what spoiler quote blocks are for.

To render a spoiler block quote, prefix one or more lines with >! rather than with >.

It shows up like this.

or with math (yes, I know this math is pretty much nonsensical, I'm just using it to give you an idea of what it'd look like):

$$\frac{\Delta{}v}{\Delta{}t} = \frac{v_{final} - v_0}{t_{end} - t_{start}} \\ x = (\Delta{}v)^{2} \cdot \epsilon{}$$

Without the spoiler block, that exact same math block is rendered as:

$$\frac{\Delta{}v}{\Delta{}t} = \frac{v_{final} - v_0}{t_{end} - t_{start}} \\ x = (\Delta{}v)^{2} \cdot \epsilon{}$$

• One problem with the spoiler approach is that its effectiveness depends on the MathJax renderer chosen by the reader; with SVG the formulas are not hidden (at least in my experience).
– user205
Jan 23 '15 at 9:14
• @ArthurFischer Good point there. This answer looked quite different in the answer preview compared to after it was posted, which may be related to that.
– user
Jan 23 '15 at 9:19
• Yeah, please don't use spoiler blocks for that; you don't save any vertical space and you make the reader do extra work. Jan 23 '15 at 15:22
• @MonicaCellio, no pixel- or scroll-space, but perhaps there are some mental space savings for the rushed, no? Jan 23 '15 at 21:28
• @SerbanTanasa hmm, maybe -- hadn't thought about that. I find the math details easy to skip when reading because they're visually so different from the surrounding text. (I'm not saying I always skip the math, but some of it is above my head.) Jan 23 '15 at 21:31

To add to Michael's answer, the only other way I could think of doing it would be put all your equations at the bottom and reference them in your answer if they are purely supplemental to your actual answer; though I would hesitate before doing this.

• Please write answers so that they flow logically -- if it makes sense to use a footnote then use a footnote, but please don't do it just for formatting. Somebody should be able to read an answer straight through and understand it. Jan 23 '15 at 15:23