MyST-Parser icon indicating copy to clipboard operation
MyST-Parser copied to clipboard

`\(`...`\)` and `\[`...`\]` not working as expected

Open dbitouze opened this issue 10 months ago • 0 comments

What version of myst-parser are you using?

2.0.0

What version dependencies are you using?

sphinx

What operating system are you using?

Linux

Describe the Bug

The documentation claims \(...\) and \[...\] should give the same result as $...$ and $$...$$. But that's not the case: the render is as (...) and [...].

Expected Behavior

As claimed by the documentation:

  • \(...\) should behave as $...$,
  • \[...\] should behave as $$...$$.

To Reproduce

On the Live Preview page, use e.g. the following configuration yaml code:

myst_enable_extensions:
- colon_fence
- deflist
- dollarmath
- amsmath
- attrs_inline
- colon_fence
- deflist
- dollarmath
- fieldlist
- html_admonition
- html_image
- replacements
- smartquotes
- strikethrough
- substitution
- tasklist
myst_heading_anchors: 2
myst_highlight_code_blocks: true

and the following input text:

$\mathrm{e}^{\mathrm{i}\pi}+1=0$

\(\mathrm{e}^{\mathrm{i}\pi}+1=0\)

$$\mathrm{e}^{\mathrm{i}\pi}+1=0$$

\[\mathrm{e}^{\mathrm{i}\pi}+1=0\]

You'll see that the raw output is:

<p><span class="formula"><span class="mathrm">e</span><sup><span class="mathrm">i</span><i>π</i></sup> + 1 = 0</span></p>
<p>(\mathrm{e}^{\mathrm{i}\pi}+1=0)</p>
<div class="formula">
<span class="mathrm">e</span><sup><span class="mathrm">i</span><i>π</i></sup> + 1 = 0
</div>
<p>[\mathrm{e}^{\mathrm{i}\pi}+1=0]</p>

that is the following HTML render:

eiπ + 1 = 0

(\mathrm{e}^{\mathrm{i}\pi}+1=0)

eiπ + 1 = 0

[\mathrm{e}^{\mathrm{i}\pi}+1=0]

dbitouze avatar Oct 11 '23 19:10 dbitouze