Skip to content

The label on an mhchem arrow is no longer clipped - #750

Merged
PathGao merged 1 commit into
masterfrom
fix/mhchem-arrow-label
Sep 2, 2026
Merged

The label on an mhchem arrow is no longer clipped#750
PathGao merged 1 commit into
masterfrom
fix/mhchem-arrow-label

Conversation

@PathGao

@PathGao PathGao commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

What this is

Follow-up to #747, which I pushed to that branch after it had been merged, so it never landed. Once \ce rendered, the reporter's second example \ce{CH4 + 2O2 ->[燃烧] CO2 + 2H2O} showed the label above the arrow with its top cut off (seen by @PathGao on a build; ref #745).

Mechanism

.katex-display sets overflow-y: hidden so a wide formula's horizontal scrollbar does not bring a vertical one, and hidden overflow clips at the padding edge. KaTeX sizes the block from its own font metrics and has none for CJK, so a CJK label is set in the fallback font and draws taller than the box. The block now carries 0.4em of vertical padding as headroom, and the margin drops from 1.5em to 1.1em, so the distance to the neighbouring blocks is unchanged.

Scope

One CSS rule. No test — a layout fact, checked on a build: clipped on the build before this change, whole after it.

Verification

npm run check       831 files, 0 errors

.katex-display hides vertical overflow so a wide formula's horizontal
scrollbar does not bring a vertical one. KaTeX sizes the block from its
own font metrics and has none for CJK, so the label in ->[燃烧] drew
taller than the box and lost its top. Padding gives the headroom; the
margin gives it back, so spacing to neighbours is unchanged.
@PathGao
PathGao merged commit 17873db into master Sep 2, 2026
4 checks passed
@PathGao
PathGao deleted the fix/mhchem-arrow-label branch September 2, 2026 01:47
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.

1 participant