Skip to content

Release 1.15.1 - #60

Merged
b451c merged 3 commits into
mainfrom
release/1.15.1
Nov 15, 2026
Merged

b451c merged 3 commits into
mainfrom
release/1.15.1

Conversation

@b451c

@b451c b451c commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Formulas: no more repeated characters inside brackets, a crash on a malformed formula, signs and spaces as LaTeX sets them.

Fixed

  • A crash on a malformed formula: a row break right after ^ or _ inside aligned, matrix or cases (for example b^\\) closed QuickMD.
  • Formulas inside brackets repeated characters: in cases, pmatrix, bmatrix and anything between \left and \right, 20 was drawn as 200 and 2x as 2xx (LaTeX: characters duplicated inside \begin{cases} (20 renders as 200, 12 as 122) #59).
  • The limits of a sum, product or integral inside \left…\right are drawn again.
  • A minus or plus sign at the start of a matrix or cases cell, or right after \displaystyle or a space command, sits against its number instead of being spaced like a subtraction.
  • Space commands have their own widths: \quad, \qquad, \; and \! were all drawn as narrow as \,.

How

All in the vendored SwiftMath: typesetting preprocesses a copy of the list and \left…\right typesets its content once (as upstream #70 and #75), the table parser grows its rows to the row it is on (upstream #76), rule 5 looks at the previous atom, and a space command is measured by its own width.

Tests

The math engine is now compiled into the test target (MathEngineTests, 13 tests that read what a formula draws). 1234 tests pass locally on a clean build; Debug, Release and Release with -DAPPSTORE build.

Closes #59

b451c and others added 3 commits November 15, 2026 12:27
… characters (#59)

In `cases`, `pmatrix`, `bmatrix` and anything between \left and \right,
"20" was drawn as "200" and "2x" as "2xx"; the limits of a \sum inside
delimiters were dropped.

Cause (vendored SwiftMath): the step that merges neighbouring characters
rewrote the caller's atoms, and makeLeftRight typeset its content twice
(once to size the delimiters, once to place it), so the second pass merged
again. Same changes as upstream SwiftMath #70 and #75:
- typesetting preprocesses a copy of the list, never the caller's atoms;
- makeLeftRight typesets its content once and reuses the display.

Tests: the engine is now compiled into the test target (MathEngineTests
reads what a formula draws; the fonts come from the source tree through
MathFontsBundle.overrideURL). Seven of the nine tests fail without the fix.
The engine's `backgroundColor` extension moves from every NSView to its own
label: with the engine in the test target it shadowed NSTextView's property
wherever an optional colour was expected.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…acing, space widths

Found while fixing #59, all in the vendored SwiftMath:

- Crash: `b^\\` inside aligned / matrix / cases took the row break as the
  exponent, advanced the row count twice and the table parser indexed a row
  it never made (a trap that closed the app). Rows now grow to the row the
  parser is on (upstream SwiftMath #76).
- Signs: TeX rule 5 looks at the previous atom; a style change or a space is
  not one. `\displaystyle -x`, `\quad -x` and every matrix or cases cell
  starting with `-` (cells begin with a style) were spaced like a
  subtraction. A subtraction keeps its spacing.
- Spaces: a space command is as wide as it asks for (`\,` 3mu, `\;` 5mu,
  `\quad` 18mu, `\qquad` 36mu, `\!` -3mu). The tokenizer measured the atom's
  type, so every one of them was a thin space.

Tests: MathEngineTests (crash inputs parse and typeset; widths compared with
each other, never with numbers). The sign and space tests fail without the
two changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@b451c
b451c merged commit 6e3e039 into main Nov 15, 2026
3 checks passed
@b451c
b451c deleted the release/1.15.1 branch November 15, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LaTeX: characters duplicated inside \begin{cases} (20 renders as 200, 12 as 122)

1 participant