Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions TeXmacs/packages/environment/env-math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,19 @@
</macro>>

<assign|aligned*|<\macro|body>
<align*|<tformat|<arg|body>>>
<tformat|<twith|table-min-cols|2>|<twith|table-max-cols|2>|<cwith|1|-1|1|1|cell-lsep|0spc>|<cwith|1|-1|1|1|cell-rsep|0.5spc>|<cwith|1|-1|-1|-1|cell-rsep|0spc>|<cwith|1|-1|-1|-1|cell-lsep|0spc>|<cwith|1|-1|1|-1|cell-bsep|0.1fn>|<cwith|1|-1|1|-1|cell-tsep|0.1fn>|<cwith|1|-1|1|1|cell-halign|r>|<cwith|1|-1|-1|-1|cell-halign|l>|<cwith|1|-1|1|-1|cell-block|no>|<arg|body>>
Comment on lines 151 to +152
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are existing Scheme-based conversion tests for LaTeX math environments (e.g. TeXmacs/tests/203_6.scm asserts the tree shape for align). This change fixes a specific regression for equation + aligned, but there doesn’t appear to be a test covering that combination yet. Adding a focused regression test for issue #2804 (importing an equation containing an aligned block) would help prevent future numbering/alignment regressions.

Copilot uses AI. Check for mistakes.
</macro>>
Comment on lines 151 to 153
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aligned* now hard-codes a large tformat block that largely duplicates the align* table formatting. This creates a maintainability risk (future changes to align* spacing/column settings may not be mirrored here) and also breaks existing customization hooks that currently work by overriding align* (e.g. env-flush-math.ts and customize/math/math-check.ts redefine align*, but those changes will no longer affect aligned*). Consider factoring the shared table formatting into a helper macro used by both align* and aligned*, or otherwise providing a shared hook so downstream packages can override one place.

Copilot uses AI. Check for mistakes.

<assign|aligned|<\macro|body>
<aligned*|<tformat|<arg|body>>>
</macro>>

<assign|alignedat*|<\macro|ncol|body>
<align*|<tformat|<arg|body>>>
<aligned*|<tformat|<arg|body>>>
</macro>>

<assign|alignedat|<\macro|ncol|body>
<align|<tformat|<arg|body>>>
<aligned*|<tformat|<arg|body>>>
</macro>>

<assign|flalign*|<\macro|body>
Expand Down
9 changes: 9 additions & 0 deletions devel/201_87.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#[201_87] Fix LaTeX formula imports using "aligned" to show correct numbering format
## 2026/02/25 Fix equation numbering alignment in `aligned` environment
### What
Redefined `aligned*`, `alignedat*`, and `alignedat` in `env-math.ts` to produce inline `tformat` tables instead of delegating to `align*`/`align`.
### Why
Issue #2804 : when using `aligned` inside `equation`, the equation number (1) appeared below the multi-line expression instead of vertically centered to the right. The root cause was that `aligned*` was aliased to `align*`.
This caused the equation number to be appended sequentially after the block rather than inline beside it.
### How
Changed the body of `aligned*` from `<align*|<tformat|<arg|body>>>` to a inline `tformat` with explicit settings. This makes `aligned` behave as an inline math construct with natural width and no block wrapping, so the equation number is placed correctly to the right.