Skip to content

Labelled align* takes an equation number (starred envs should be unnumbered regardless of identifier) #83

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

A labelled align* takes a real equation number. align* is unnumbered in amsmath, and #81's own description says "align* and friends: unnumbered" — but that only holds when the node has no identifier.

Reproduce

With numbering: {book: {enabled: true}}:

$$
z_0 = 0
$$ (eq-base0)

(eq-star-outer)=

$$
\begin{align*}
a &= b \\
c &= d
\end{align*}
$$

$$
z_1 = 1
$$ (eq-base1)

Built AST:

node enumerator
eq-base0 1
eq-star-outer (the align*) 2
eq-base1 3

The starred environment consumed number 2 and pushed everything after it along. Without the (eq-star-outer)= anchor the same block is correctly unnumbered.

Cause

packages/myst-transforms/src/math.ts sets the unnumbered flag only when the node has no identifier:

if (node.enumerated == null && !node.identifier) node.enumerated = false;

Once a label is attached the !node.identifier guard fails, so the starred env falls through to normal numbering and also loses node.rows.

Expected

A starred environment is unnumbered regardless of whether it carries a label. In LaTeX, \label inside align* is legal — it just refers to whatever the enclosing counter last was — and it certainly does not cause the environment to be numbered.

Why it matters downstream

This is a live shape: book-dp1's ch_ctime.tex has a labelled align* (eq:vgctp), the only one across the three QuantEcon books. The converter currently emits starred envs as a {math} directive with :enumerated: false to force the correct behaviour; that workaround exists precisely because of this. If this is fixed we can drop it and pass starred envs through like the non-starred ones.

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