There are some posts which give solutions for Latex, but no one seems to work here on StackExchange. Is it possible to use this toggle show/hide here on StackExchange? Like when I want to toggle show/hide a mathematical proof.

Here is an example (though math doesn't seem to work here...).

Theorem: $$n>n-1 \forall n\in{\mathbb{N}}$$

proof: \toggle_on show/hide For $n=1$ the statement $1>0$ is obviously true. Suppose it is true for $n$ then for $n\rightarrow n+1$ it follows $$n+1>n-1+1=n \quad \square \, .$$ \toggle_off \show/hide

edit: LoL? Are you guys serious? Read my question again... This is not about math displaying using MathJax. It was just used as an example, because somebody asked for it and then I realized math doesn't even work here. But I don't actually care! The question is about a toggle option you also sometimes find on Wikipedia: https://en.wikipedia.org/wiki/Reynolds_transport_theorem#Form_for_a_material_element

  • 3
    This belongs on Meta. Voted to migrate. May 1 '19 at 22:55
  • Are you talking about a "spoiler"?
    – Werner Mod
    May 1 '19 at 23:14
  • Sort of yes....
    – Diger
    May 1 '19 at 23:18
  • Perhaps you want OCGs (optional content groups, aka PDF Layers)? Pkg ocgx2 could help you.
    – AlexG
    May 2 '19 at 7:06
  • How can I bind packages here on StackExchange?
    – Diger
    May 2 '19 at 7:24
  • So is it possible?
    – Diger
    May 2 '19 at 11:57
  • @Diger: If by packages you mean (La)TeX packages, then you can't. You can only post markdown-related content.
    – Werner Mod
    May 2 '19 at 15:23
  • markdown-related content?
    – Diger
    May 2 '19 at 15:59
  • Can you make an example if that is close to what I'm looking for?
    – Diger
    May 2 '19 at 20:06
  • Can you edit the question and explain in more detail what you are trying to achieve? I don't quite get what you want.
    – Johannes_B
    May 3 '19 at 5:24
  • There you go...
    – Diger
    May 3 '19 at 10:31
  • Can you clarify if this is about formatting posts on tex.stackexchange.com or about creating a pdf?
    – user188004
    May 3 '19 at 10:49
  • I want to do this on math.stackexchange.com and was wondering if it is possible there...
    – Diger
    May 3 '19 at 11:56
  • No, it is not possible here. We want and need to see the LaTeX code at all times.
    – Johannes_B
    May 4 '19 at 5:29
  • I guess the confusion is partly fuelled by the fact that this question was first asked on the main site (tex.stackexchange.com/q/488679/35864), which is only about LaTeX and not about markdown or StackExchange, and also by the fact that LaTeX and mathematical proofs are mentioned so prominently. Last but not least, there is not a lot this per-site meta can do about general markdown rendering, most of that is network-wide and then meta.stackexchange.com would be the right place to discuss this.
    – moewe
    May 4 '19 at 12:21

The closest we have to show/hide is the "spoiler" blockquote. But it always occupies the space it would occupy if the content were shown, so you don't win a lot if you want to save space.

See Add markdown support for hidden-until-you-click text (aka spoilers) and What's the exact syntax for spoiler markup.

>! This is a spoiler


! This is a spoiler

The feature request for collapsible content has been declined: Please add the ability to fold blocks of code in questions and answers

In any case, such requests should probably be brought forward network-wide on https://meta.stackexchange.com/ and not on this per-site meta.

  • Yeah, unfortunately the folding I wanted to use was to save space. In that sense it is not an option. And I can not actually believe that this feature was already considered 6 years ago, but rejected...
    – Diger
    May 4 '19 at 12:38
  • So i see that this toggling option can be implemented by JavaScript. But JS only works on META and not even here on Tex/Meta, why?
    – Diger
    May 4 '19 at 12:49
  • @Diger I don't know what exactly you mean with JavaScript works on meta, but not here, but I doubt I could answer the why even if I knew what you mean. Sometimes SE move in mysterious ways.
    – moewe
    May 4 '19 at 14:04
  • I meant: <!-- begin snippet: js hide: true --> <!-- language: lang-js --> alert('Most folded code ever!'); <!-- end snippet --> which you find on meta.stackexchange.com/questions/5199/… when you scroll down to SeldomNeedys answer.
    – Diger
    May 4 '19 at 17:17

Not the answer you're looking for? Browse other questions tagged .