Skip to content

Only the first row of a row-numbered env gets a DOM anchor, so later-row {eq} links have no target #85

Description

@mmcky

Found while adopting qe-v9 in the LaTeX→MyST converter (QuantEcon/claude-latex-to-myst#186). Verified against myst v1.10.1 (qe-v9).

Summary

In a row-numbered environment, every row gets its own target in the AST, but only the first row's identifier is emitted as a DOM anchor. A {eq} reference to any later row resolves to the correct number, then links to an id that does not exist in the page.

Reproduce

$$
\begin{align}
p &= 1 \label{eq-rowp}\\
q &= 2 \label{eq-rowq}
\end{align}
$$

Refs: {eq}`eq-rowp` and {eq}`eq-rowq`.

AST — both rows have distinct targets, and the block adopts the first row's html_id:

identifier enumerator html_id
block None eq-rowp
row 1 eq-rowp 5 eq-rowp
row 2 eq-rowq 6 eq-rowq

Rendered HTML — only one anchor exists:

id present in _build/html/index.html
eq-rowp yes, on the block <div class="flex my-5 group">
eq-rowq absent

Both references resolve and both show the right number — (5) and (6) — so nothing warns. The second link simply has no target to scroll to.

Expected

Each numbered row should carry its own anchor in the rendered output, so a per-row reference lands on that row. If per-row DOM anchors are impractical, having later rows fall back to the block anchor would at least be a working link — the current state is a link to a nonexistent id.

Note on scope

This is a rendering/anchor gap, not a numbering one — numbering from #81 is correct throughout, and I could not fault it. Rows of one environment are adjacent on screen, so the practical impact is modest for short blocks and grows with long ones.

Why it matters downstream

The converter currently keeps multi-label align blocks off the passthrough path and splits them into separate $$ blocks, each of which gets its own real anchor. That is the only reason references in the QuantEcon books still land correctly. It costs the shared & alignment axis that #81 otherwise preserves, so fixing this would let those blocks pass through and render as one aligned system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions