4
$\begingroup$

I would like to use a spoiler in this post of the the proof of the point $1$-$3$ but unfortunately I was not able: so is it possible use a spoiler?

$\endgroup$
6
  • $\begingroup$ Perhaps you could say what happened when you tried, or add a screen shot. $\endgroup$ Jun 3 at 14:38
  • 1
    $\begingroup$ @PeterPhipps I happen nothing if I use only the command >!; whereas if I use the command \begin{allign}\end{alling} then the latex change drastically becoming unreadble. $\endgroup$ Jun 3 at 14:41
  • $\begingroup$ @PeterPhipps Anyway you can copy the text of the question in the sandbox and verify by your self. $\endgroup$ Jun 3 at 14:42
  • 5
    $\begingroup$ Spoiler formatting is (perhaps intentionally) quite limited. It seems that one will have to use HTML to work around this deficiency. See Spoilers don't support block formatting (and so don't format well) on Meta SE. $\endgroup$ Jun 3 at 14:57
  • 2
    $\begingroup$ You have embedded the entire post in block form, and used doubly block formatting. I'd suggest you use block quotes far, far, far, more sparingly. Spoilers, as You note, do not work inside of block formatting: just highlighting @TheAmplitwist 's spot on post and link. In case you don't understand Block formatting, it is when you use >{text or mathjax, preceding the first level, and >>{text or mathjax} preceding the points you want to use spoilers on. So lose the excessive block formatting. $\endgroup$
    – amWhy
    Jun 3 at 19:12
  • $\begingroup$ @amWhy I used block form only to divide the "paragraphs" of the question: perhaps there is a way to adjust the paragraph without blocks? $\endgroup$ Jun 4 at 7:59

1 Answer 1

9
$\begingroup$

This is from the link in The Amplitwist's comment. The following mix of spoilers with HTML

>! <ol>
>! <li> First point;<br/>
>! First point continuing on a newer line, </li>
>! <li> listB $E=mc^2$, and </li>
>! <li> listC. </li>
>! </ol>

results in

  1. First point;
    First point continuing on a newer line,
  2. listB $E=mc^2$, and
  3. listC.

Note <br/> used to force a new line; <ol>...</ol> can be replaced with <ul>...</ul> to change the ordered list into an unordered list. For other things that break in spoiler tags, see the link.

There is a second way, using MathJax to reimplement the spoiler. Adapting from Hierarchical spoilers , How To Hide An Array on MathSE, we first add $\require{action}$$\require{action}$ somewhere on the page. Then we can write

 1. $\toggle{\text{click to show first spoiler}}{X}\endtoggle$
 2. $\toggle{\text{click to show second spoiler}}{Y}\endtoggle$
 3. $\toggle{\text{click to show third spoiler}}{Z}\endtoggle$

to achieve

  1. $\toggle{\text{click to show first spoiler}}{X}\endtoggle$
  2. $\toggle{\text{click to show second spoiler}}{Y}\endtoggle$
  3. $\toggle{\text{click to show third spoiler}}{Z}\endtoggle$

You could also reimplement the list numbers using the array environment so that one click reveals all, but its longer to type:

$\toggle{
\begin{array}{l}
\begin{array}{rl}
1.& \\
2.& \\
3.& \\
\end{array} \\
\text{click to show spoilers}
\end{array}
}{
\begin{array}{l}
\begin{array}{rl}
1.& X \\
2.& Y \\
3.& Z \\
\end{array} \\
\text{click to hide spoilers}
\end{array}
}\endtoggle$

gives

$\toggle{ \begin{array}{l} \begin{array}{rl} 1.& \\ 2.& \\ 3.& \\ \end{array} \\ \text{click to show spoilers} \end{array} }{ \begin{array}{l} \begin{array}{rl} 1.& X \\ 2.& Y \\ 3.& Z \\ \end{array} \\ \text{click to hide spoilers} \end{array} }\endtoggle$

One issue with these is that the spoilers are a little visible while the MathJax is loading. You can also 'pretty up' a button; see Hierarchical spoilers.

$\endgroup$
5
  • $\begingroup$ Oh, fine! Only a last question before to approve the answer: is possible to put the spoiler after the list number? E.g. is it possible to put spoiler of "First point" after 1. in order to it is possibile to see how numbers have the list? $\endgroup$ Jun 4 at 11:13
  • $\begingroup$ @AntonioMariaDiMauro , I think the same method would not work. So I added a different method that I remembered. $\endgroup$ Jun 4 at 11:36
  • 1
    $\begingroup$ Okay, question upvoted and approved: thanks very much for your assistance!!! $\endgroup$ Jun 4 at 12:05
  • 1
    $\begingroup$ You can also add a grey box in MathJax: $$ \bbox[#f0f2f2,5px,border:3px solid #c9cdd0] {\large \substack{\toggle{ \begin{array}{l} \text{Reveal spoiler} \end{array} }{ \begin{array}{l} \begin{array}{rl} 1.& X \\ 2.& Y \\ 3.& Z \\ \end{array} \end{array} }\endtoggle} } $$ $\endgroup$
    – user905694
    Jun 4 at 12:07
  • $\begingroup$ $$\toggle{\text{This}}{\toggle{\text{seems}}{\toggle{\text{fun,}}{\toggle{\text{if}}{\toggle{\text{a}}{\toggle{\text{bit}}{\text{annoying!}}\endtoggle}\endtoggle}\endtoggle}\endtoggle}\endtoggle}\endtoggle$$ $\endgroup$ Jun 11 at 10:41

You must log in to answer this question.

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