Skip to content

fix(docs): remove spurious vertical scrollbar on display equations#1162

Open
jmoraispk wants to merge 1 commit into
NVlabs:mainfrom
jmoraispk:fix/mathjax-vertical-scrollbar
Open

fix(docs): remove spurious vertical scrollbar on display equations#1162
jmoraispk wants to merge 1 commit into
NVlabs:mainfrom
jmoraispk:fix/mathjax-vertical-scrollbar

Conversation

@jmoraispk

Copy link
Copy Markdown

Summary

Every display equation in the documentation renders with a small, spurious vertical scrollbar.

Cause: With the current Sphinx / MathJax v3 setup, pydata-sphinx-theme applies overflow: auto to div.math mjx-container. A sub-pixel height mismatch between the theme font and MathJax's font then triggers a vertical scrollbar on every equation.

Fix: Override overflow-y: hidden using the same selector so it wins the cascade, while keeping overflow-x: auto so wide equations can still scroll horizontally.

Changes

  • doc/source/_static/custom.css: add a single div.math mjx-container { overflow-y: hidden; } rule.

Testing

Rebuilt the docs and verified in the browser that none of the display equations on the EM primer page show a vertical scrollbar, and that wide equations still scroll horizontally.

The pydata-sphinx-theme sets 'overflow: auto' on 'div.math mjx-container', which makes MathJax v3 render a small vertical scrollbar next to every display equation. Override overflow-y to hidden (matching the theme's selector so it wins the cascade) while preserving horizontal scrolling for wide equations.
@jmoraispk

Copy link
Copy Markdown
Author

BEFORE:
image

AFTER:
Screenshot 2026-05-31 075319

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