jupyter-book / jupyter-book

Create beautiful, publication-quality books and documents from computational content.
http://jupyterbook.org
BSD 3-Clause "New" or "Revised" License
3.86k stars 661 forks source link

Display math in admonition #2144

Open tyl012 opened 7 months ago

tyl012 commented 7 months ago

Describe the bug

issue I tried to put some content with display math inside an admonition block, but the output html form is incorrect.

Reproduce the bug

I tried to put the following content

A linear map $f:\mathbb{C}\to\mathbb{C}$ is of the form
$$f\left(z\right)=az+b$$
where $a,b\in\mathbb{C}$.

in an admonition block

```{tip} 
A linear map $f:\mathbb{C}\to\mathbb{C}$ is of the form
$$
f\left(z\right)=az+b
$$
where $a,b\in\mathbb{C}$.
````

However, the output in html file is apparently incorrect, comparing the upper part and the middle one in the screenshot

issue_prtscr

The indentation of the line following the displayed part is wrong, and strange spacing was added around the inline math. The lower part of the screenshot shows a simple fix of the issue when I add a line before the double dollar sign of the display math (adding a line after the display math works equally well)

```{tip} 
A linear map $f:\mathbb{C}\to\mathbb{C}$ is of the form

$$
f\left(z\right)=az+b
$$
where $a,b\in\mathbb{C}$.
```

List your environment

My environment is

Jupyter Book      : 1.0.0
External ToC      : 1.0.1
MyST-Parser       : 2.0.0
MyST-NB           : 1.0.0
Sphinx Book Theme : 1.1.2
Jupyter-Cache     : 1.0.0
NbClient          : 0.7.0
welcome[bot] commented 7 months ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada: