feat: \nonumber/\notag support, \tag per row of {align} (#2952)

* feat: \nonumber and \notag support

Support `\nonumber` (and equivalent `\notag`) using a global macro
`\@eqnsw` to track whether one occurs in each row, similar to how
amsmath uses global `\@eqnswtrue`/`\@eqnswfalse`.

Fix #2950

* Remove duplicate mention of align*

* Working version of \tag within {align}

* Simpler subparse mechanism

* Fix flow errors, clarifying set-to-undefined

* Document that \tag works in rows

* Add screenshot tests

* Add Jest tests

* Add Safari screenshot

* Commit message about fixing \tag

Fixes #2379

* Apply suggestions from code review

Co-authored-by: ylemkimon <y@ylem.kim>

* Revise and move getAutoTag

* Fix handling of split

* Remove unnecessary feedTokens

Co-authored-by: ylemkimon <y@ylem.kim>

Co-authored-by: ylemkimon <y@ylem.kim>
This commit is contained in:
Erik Demaine
2021-10-31 17:40:06 -04:00
committed by GitHub
parent a59135fd77
commit 52c4778b15
12 changed files with 131 additions and 29 deletions

View File

@@ -3606,6 +3606,19 @@ describe("\\tag support", function() {
expect`\tag{1}\tag{2}x+y`.not.toParse(displayMode);
});
it("should fail with multiple tags in one row", () => {
expect`\begin{align}\tag{1}x+y\tag{2}\end{align}`.not.toParse(displayMode);
});
it("should work with one tag per row", () => {
expect`\begin{align}\tag{1}x\\&+y\tag{2}\end{align}`.toParse(displayMode);
});
it("should work with \\nonumber/\\notag", () => {
expect`\begin{align}\tag{1}\nonumber x\\&+y\notag\end{align}`
.toParseLike(r`\begin{align}\tag{1}x\\&+y\nonumber\end{align}`, displayMode);
});
it("should build", () => {
expect`\tag{hi}x+y`.toBuild(displayMode);
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -23,7 +23,13 @@ AccentsText: |
\text{\.I İ} & \text{\H e e̋} & \text{\i ı}
\end{array}
Align:
tex: \begin{align}a &= 1 & b &= 2 \\ 3a &= 3 & 17b &= 34\end{align}
tex: |
\begin{align}
a &= 1 & b &= 2 \\
3a &= 3 & 17b &= 34 \\
\tag{$\ast$} a &\neq b \\
\nonumber a &={}? & b &={}? \\
\end{align}
display: 1
Aligned: |
\begin{aligned}