executablebooks / MyST-Parser

An extended commonmark compliant parser, with bridges to docutils/sphinx
https://myst-parser.readthedocs.io
MIT License
708 stars 189 forks source link

Add `:tag:` Option for Custom Equation Numbering in `{math}` Directives #928

Open mscharling opened 2 months ago

mscharling commented 2 months ago

Describe the feature you'd like to request

I am proposing the addition of a :tag: option for the {math} directive. Currently, equations can only be labeled for referencing within the document using :label:, and they automatically receive a numeric identifier. It would be beneficial, especially when covering properties of some specific math area, to allow custom tags for equations using a :tag: option.

Describe the solution you'd like

Enable the use of a :tag: option within {math} blocks to specify custom equation numbers directly in the text, allowing for alphanumeric identifiers like "A1", "B2", etc. This feature would help maintain consistency in mathematical notation, especially in texts transitioning from traditional LaTeX environments or requiring specific identification schemes for equations.

Describe alternatives you've considered

I have considered using the LaTeX \tag{} command within double-dollar environments as an alternative to address custom equation tagging needs: $$\frac{a}{b} \pm \frac{c}{d} = \frac{ad \pm bc}{bd} \tag{B1}$$ While this method allows for custom tags within equations, it introduces inconsistencies in font style between the equation content and the tag. The tag rendered by \tag{} often does not match the main document font when refering, leading to a disjointed visual appearance.

welcome[bot] commented 2 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: