[201_85] Fix : LaTeX formula imports using aligned to show correct numbering format#2861
[201_85] Fix : LaTeX formula imports using aligned to show correct numbering format#2861git-lakshy wants to merge 1 commit intoMoganLab:mainfrom
Conversation
|
Nice work! LGTM. |
|
Resolved merge conflicts, please review this PR |
There was a problem hiding this comment.
Pull request overview
This PR adjusts TeXmacs’ math environment macros so LaTeX imports using aligned inside equation place the equation number inline (vertically centered to the right) instead of below the multi-line expression.
Changes:
- Redefines
aligned*to build an inlinetformattable directly (instead of delegating toalign*). - Updates
alignedat*andalignedatto delegate to the newaligned*implementation. - Adds a leading blank line to
devel/201_85.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
TeXmacs/packages/environment/env-math.ts |
Changes aligned*/alignedat*/alignedat macro definitions to fix equation-number placement for imported LaTeX aligned blocks. |
devel/201_85.md |
Introduces a new leading blank line at the start of the dev log entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <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>> | ||
| </macro>> |
There was a problem hiding this comment.
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.
| <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>> |
There was a problem hiding this comment.
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.
fixes #2804
[201_87] : Fix LaTeX formula imports using "aligned" to show correct numbering format
2026/02/25 Fix equation numbering alignment in
alignedenvironmentWhat
Redefined
aligned*,alignedat*, andalignedatinenv-math.tsto produce inlinetformattables instead of delegating toalign*/align.Why
Issue #2804 : when using
alignedinsideequation, the "equation number" appeared below the multi-line expression instead of vertically centered to the right. The root cause was thataligned*was aliased toalign*.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 inlinetformatwith explicit settings. This makesalignedbehave as an inline math construct with natural width and no block wrapping, so the equation number is placed correctly to the right.Screenshots
before


after