mystmd
mystmd copied to clipboard
Properly label, display and reference subequations
There are some changes we made to parsing latex subequations and for align environments to allow these to be picked up and translated to both JATS (used for archiving scientific documents) and the HTML view with basic rendering and cross-references. The challenge in representing this in MyST (and in JATS) is that those environments need to be in charge of the equation labelling and numbering (with specific nodes/attributes for the cross references), and this fights with latex (or at least needs to share understanding). There is actually no way to do a multi-line, labeled subequations in JATS for example, and the way people do it with an disp-formula-group completely destroys the alignment that is the goal of the align and gather groups in the first place. So we are stuck somewhere between this:
and this:
The way that I am thinking that we get around that is actually by holding both of these variants in the tree, and we introduced a mathGroup (similar to a citeGroup) that has the raw latex to be rendered as well as the children nodes. Right now that mathGroup only renders the children/numbers, but we should update the UI to show the original with the labels they will need to be generated by katex rather than myst (then updating the enumerators with a post html transform or css perhaps to match the numbering). A start in that direction which works from tex-->jats is shown in a test here. I think the combination of these with the fixes suggested above should allow us to fully support both the semantics and the visual-alignment.