fix: remove extra \jot space at bottom of align/gather/etc.#4184
fix: remove extra \jot space at bottom of align/gather/etc.#4184
Conversation
Greptile SummaryThis PR fixes a long-standing visual bug (#3142, #2911) where Key changes:
Notes:
Confidence Score: 5/5Safe to merge — the fix is minimal, correct, and well-tested; no logic regressions identified. The core change is a single guard condition that is trivially correct for all row counts (0 jot on a single row, jot only between rows for N > 1). Both new tests validate the expected semantics. The only remaining items are a minor test-comment suggestion (P2) and the known need to regenerate screenshotter baselines, neither of which blocks correctness. Screenshotter baseline images for Align, Aligned, Alignedat, Gather, and Gathered need regeneration after this change. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["htmlBuilder loop\nfor r = 0 to body.length-1"] --> B["compute row height & depth\n(arstrut baseline)"]
B --> C{"rowGap[r] set?"}
C -- yes --> D["gap = calculateSize(rowGap)\nif gap > 0: depth = max(depth, arstrutDepth+gap)"]
C -- no --> E["gap = 0"]
D --> F
E --> F{"group.addJot AND\nr < body.length - 1?"}
F -- "yes (between rows)" --> G["depth += jot ✅ space added"]
F -- "no (last row)" --> H["depth unchanged ✅ no extra space"]
G --> I["totalHeight += height + depth + gap"]
H --> I
Reviews (1): Last reviewed commit: "fix: remove extra \jot space at bottom o..." | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
Looks great! |
|
🎉 This PR is included in version 0.16.44 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [0.16.44](KaTeX/KaTeX@v0.16.43...v0.16.44) (2026-03-27) ### Bug Fixes * remove extra \jot space at bottom of align/gather/etc. ([KaTeX#4184](KaTeX#4184)) ([3870ee9](KaTeX@3870ee9))
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [katex](https://katex.org) ([source](https://github.com/KaTeX/KaTeX)) | [`0.16.40` → `0.16.44`](https://renovatebot.com/diffs/npm/katex/0.16.40/0.16.44) |  |  | --- ### Release Notes <details> <summary>KaTeX/KaTeX (katex)</summary> ### [`v0.16.44`](https://github.com/KaTeX/KaTeX/blob/HEAD/CHANGELOG.md#01644-2026-03-27) [Compare Source](KaTeX/KaTeX@v0.16.43...v0.16.44) ##### Bug Fixes - remove extra \jot space at bottom of align/gather/etc. ([#​4184](KaTeX/KaTeX#4184)) ([3870ee9](KaTeX/KaTeX@3870ee9)) ### [`v0.16.43`](https://github.com/KaTeX/KaTeX/blob/HEAD/CHANGELOG.md#01643-2026-03-26) [Compare Source](KaTeX/KaTeX@v0.16.42...v0.16.43) ##### Bug Fixes - use makeEm() consistently to truncate long CSS decimals ([#​4181](KaTeX/KaTeX#4181)) ([0967dcc](KaTeX/KaTeX@0967dcc)) ### [`v0.16.42`](https://github.com/KaTeX/KaTeX/blob/HEAD/CHANGELOG.md#01642-2026-03-24) [Compare Source](KaTeX/KaTeX@v0.16.41...v0.16.42) ##### Features - \underbracket and \overbracket ([#​4147](KaTeX/KaTeX#4147)) ([5be9abb](KaTeX/KaTeX@5be9abb)) ### [`v0.16.41`](https://github.com/KaTeX/KaTeX/blob/HEAD/CHANGELOG.md#01641-2026-03-24) [Compare Source](KaTeX/KaTeX@v0.16.40...v0.16.41) ##### Bug Fixes - \sout in text mode ([#​4173](KaTeX/KaTeX#4173)) ([e748578](KaTeX/KaTeX@e748578)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My44Ni4wIiwidXBkYXRlZEluVmVyIjoiNDMuOTkuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: Renovate Bot <renovate@zarantonello.dev> Co-committed-by: Renovate Bot <renovate@zarantonello.dev>
What is the previous behavior before this PR?
aligned-like environments add
\jotspace after every row, thanks to old me in #725.What is the new behavior after this PR?
aligned-like environments add
\jotspace between rows — no space after the last row — as past me investigated in #3142 (comment)This is a recreation/rebasing of #4050, with extra comments and tests, as I investigated #2911 and it turned out to be this issue. I've marked @mvr as a coauthor on my commit.
Fixes #3142
Fixes #2911 which now looks like

Screenshot diffs show improved centering: