mystmd: MD -> LaTeX: `gather` is not properly generated

Description

Consider the following document:

Some introduction text

\begin{gather}
    E=mc^2
\end{gather}

The issue is that the LaTeX document that it generates becomes:

Some introduction text

\begin{equation}
\begin{gather}
    E=mc^2
\end{gather}
\end{equation}

This should not be surrounded by equation block

Proposed solution

  • Distinguish which environments need to be within a math environment, e.g. gathered vs gather
  • Distinguish which environments handle numbering gathered vs gather
  • Distinguish when we want something to be numbered and not gather vs gather*

Then conditionally add either equation or equation* or nothing to the LaTeX document

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

Could mathGroup behave like admonitions in that on the markdown side it’s a container like the \begin{} environments that we can pass specific class: align? Something like

:::{mathGroup}
:class: align

x + y & \geq 0

x - y & \leq 4

x \times y & \geq 1

x^y + y^x &\geq 1
:::

would generate

\begin{align}
x + y & \geq 0 \\
x - y & \leq 4 \\
x \times y & \geq 1 \\
x^y + y^x &\geq 1
\end{align}

Not sure how to deal with label in that case either unless we just allow them to be defined in there as well and just parse the contents of it from TeX and back.

Yes, there are two questions here:

  1. Short-term fix?
  2. Long-term changes?

I think we should look to fix this as-is, and discuss longer-term AST changes in a new issue 😃

I think we should try and strip the ASMMath environment so that we can add labels. This makes things more complicated, but is the “right” thing to do imo.

@LecrisUT I just had a meeting with @rowanc1 where it became clear I think I misunderstood the document type that you’re using; I’d thought you were using LaTeX -> LaTeX, but it seems like you’re actually reading MyST -> LaTeX. I’m just working on some other PRs at the moment, but I’ll circle back around to this shortly.