Skip to content

\enclose{roundedbox} mis-sized and vertically misaligned for \frac / tall content (regression or incomplete fix of #1697) #3043

Description

@kevin1078

Description

\enclose{roundedbox}{…} does not correctly wrap tall math (especially \frac with nested \sqrt). The border is not vertically centered, and the box size does not match the laid-out content.
Reproducible with convertLatexToMarkup() and <math-field> on MathLive 0.110.0 (npm). Same LaTeX looks correct in MathJax (MathML menclose).

Steps to reproduce

Paste into the MathLive demo or any math-field:

\enclose{roundedbox}[shadow="none",1px dotted #cd0030]{\frac{x^2+y^2}{\sqrt{x^2+y^2}}}
Simpler case:
\enclose{roundedbox}[mathcolor=red]{\frac{a}{b}}

More cases:
\displaylines{\enclose{updiagonalstrike roundedbox}[mathbackground="#fbc0bd",shadow="none", solid red]{x=0}\\
 \enclose{circle}[mathbackground="#fbc0bd",shadow="none", solid currentColor]{\frac{1}{x}}\\
 \enclose{roundedbox}[shadow="none",1px dotted #cd0030]{\frac{x^2+y^2}{\sqrt{x^2+y^2}}}\\
 }

Actual behavior
Content sits too high inside the box (top-aligned).
Border box is wider than the inner math box (default fboxsep padding ≈ 0.3em).
For the fraction+sqrt example (0.110.0): host 3.08em tall / 7.92em wide; body 2.49em tall; .ML__notation ~8.52em wide.
Expected behavior
Content centered in the border; border tightly wraps content + uniform padding.

Technical notes
In EncloseAtom.render (0.110.0): .ML__notation is position:absolute; top:0; body child is not vertically centered; default padding from fboxsep when padding is unset.

Partial workaround: padding="0" — reduces horizontal overflow, does not fix vertical centering for \frac.

Related
#1697 (\enclose + padding + \frac, closed but fraction cases still look wrong)
#2919 (GenfracAtom / tall content sizing since 0.108)
Environment
MathLive 0.110.0
Windows 10

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions