mdBook icon indicating copy to clipboard operation
mdBook copied to clipboard

MathJax inside HTML `details` tag

Open your-diary opened this issue 3 years ago • 1 comments

Is is possible to render MathJax inside <details> tag?

Input

<details>
<summary>Proof</summary>
\\[
    {}_{N - 1} C _{M - 1}
\\]
</details>

Output

▼ Proof
\\[ {}_{N - 1} C _{M - 1} \\]

(The equation is output as it is. Not rendered...)


By the way, I use mdbook for mathematical writing (rather than LaTeX), and I sometimes want to embed a long proof inside a <details> tag.

your-diary avatar Nov 14 '22 15:11 your-diary

I tried this with the mdbook-katex preprocessor and it is rendered. I recommend you to give it a shot.

~Note that you currently have to use $ and $$ instead, though.~ Edit: mdbook-latex supports custom delimiters now.

Steven Hé (Sīchàng)

SichangHe avatar Dec 15 '22 03:12 SichangHe

@SichangHe I just tested it today and it worked like a charm. Thank you for your suggestion and I'm sorry for my very late reply.

your-diary avatar Apr 22 '23 03:04 your-diary

Finally found a solution without the need of mdbook-katex.

Just insert an empty line after the closing </summary> tag.

<details>
<summary>Proof</summary>

\\[
    {}_{N - 1} C _{M - 1}
\\]
</details>

ref: #2145

your-diary avatar Aug 21 '23 13:08 your-diary