Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$$ equation reference is not identified unless preceded by a blank line #897

Open
tillahoffmann opened this issue Mar 29, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@tillahoffmann
Copy link

What version of myst-parser are you using?

2.0.0

What version dependencies are you using?

pydata-sphinx-theme==0.15.2
sphinx-book-theme==1.1.2
sphinxcontrib-applehelp==1.0.8
sphinxcontrib-devhelp==1.0.6
sphinxcontrib-htmlhelp==2.0.5
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==1.1.10
docutils==0.20.1

What operating system are you using?

Mac

Describe the Bug

Equation labels in dollar math are not identified unless the equation is preceded by a blank line. For example, the following two versions work as expected.

First.

$$
a = b + c
$$ (my-eqn)

{eq}`my-eqn`
First.

$$
a = b + c
$$ (my-eqn)
{eq}`my-eqn`

But this version fails with a missing reference.

First.
$$
a = b + c
$$ (my-eqn)

{eq}`my-eqn`

My conf.py contains

myst_enable_extensions = [
    "dollarmath",
]
myst_dmath_double_inline = True
myst_dmath_allow_labels = True

Expected Behavior

Equation labels are identified even if no blank line precedes the equation.

To Reproduce

See above.

@tillahoffmann tillahoffmann added the bug Something isn't working label Mar 29, 2024
Copy link

welcome bot commented Mar 29, 2024

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

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! 🎉

@72757373656c6c
Copy link
Contributor

This is an interesting Issue. The use of spaces, number of spaces, and blank lines is one aspect of MyST-Parser that I'm trying to understand better and be consistent.

From reading the MyST-Parser documentation on Paragraphs , it says,


Paragraphs are block of text separated by a blank line.

From the above, I would say there's a requirement for a blank line between the paragraph block (First.) and the $$ extension. When there is is no blank line, the MyST-Parser reads everything until a blank as a paragraph block, thus my-eqn is not defined, resulting in the missing reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants