Skip to content

Commit 4d63a9e

Browse files
committed
fix(math): Properly apply 'cramping' styles in text mode and for radicands
Default text style shouldn't be cramped. Radicands in roots shoud trigger cramping.
1 parent d33b285 commit 4d63a9e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/math/base-elements.lua

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,13 +1592,17 @@ end
15921592
function elements.table:output () end
15931593

15941594
local function getRadicandMode (mode)
1595-
-- Not too sure if we should do something special/
1596-
return mode
1595+
-- TeX \sqrt change sregular styles to cramped ones
1596+
if isCrampedMode(mode) then
1597+
return mode
1598+
end
1599+
return mode + 1
15971600
end
15981601

15991602
local function getDegreeMode (mode)
1600-
-- 2 levels smaller, up to scriptScript evntually.
1601-
-- Not too sure if we should do something else.
1603+
-- Two levels smaller, up to scriptScript eventually.
1604+
-- As far as can be observed, LaTeX doesn't change cramped vs. non-cramped
1605+
-- for the degree.
16021606
if mode == mathMode.display then
16031607
return mathMode.scriptScript
16041608
elseif mode == mathMode.displayCramped then

packages/math/typesetter.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ local function handleMath (_, mbox, options)
383383
if mode == "display" then
384384
mbox.mode = b.mathMode.display
385385
elseif mode == "text" then
386-
mbox.mode = b.mathMode.textCramped
386+
mbox.mode = b.mathMode.text
387387
else
388388
SU.error("Unknown math mode " .. mode)
389389
end

0 commit comments

Comments
 (0)