Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some inline formulas cause a height issue #3334

Closed
mzy0624 opened this issue Feb 22, 2025 · 2 comments
Closed

Some inline formulas cause a height issue #3334

mzy0624 opened this issue Feb 22, 2025 · 2 comments
Labels
Accepted Issue has been reproduced by MathJax team Code Example Contains an illustrative code example, solution, or work-around Ready for Development v3

Comments

@mzy0624
Copy link

mzy0624 commented Feb 22, 2025

Issue Summary

.issue {
    max-height: 400px;
    overflow-y: auto;
}

I have a div element, where when the height of content > 400px, page scrolling will occurs.

But there is an issue: when I use some inline formulas like a b , i = 1 n ..., page scrolling will occurs even if the height of content < 400px. For example:

Image

The corresponding code:

<div style="text-align: center; margin: 0 auto; border: 1px solid #ccc; padding: 10px;">
    <div class="issue">
        The issue occurs $\frac{1}{2}$
    </div>
</div>

Image

The corresponding code:

<div style="text-align: center; margin: 0 auto; border: 1px solid #ccc; padding: 10px;">
    <div class="issue">
        The issue doesn't occur $a+b=c$
    </div>
</div>

Technical details:

  • MathJax Version: 3
  • Ubuntu 24.04
  • Browser: Chrome 133.0.6943.126

I am using the following MathJax configuration:

MathJax = {
    tex: { 
        inlineMath: [['$','$']], 
        displayMath: [['$$','$$']] 
    }
};

and loading MathJax via

<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
@dpvc
Copy link
Member

dpvc commented Feb 24, 2025

Try adding the CSS

mjx-mo > mjx-c,
mjx-mi > mjx-c,
mjx-mn > mjx-c,
mjx-ms > mjx-c,
mjx-mtext > mjx-c,
mjx-stretchy-h,
mjx-stretchy-v {
  clip-path: padding-box xywh(-1em -2px calc(100% + 2em) calc(100% + 4px));
}
mjx-math {
  padding: 0 ! important;
  margin: 2px 0;
}

I think that should take care of it for you. This is part of a change that has been made in v4 (now out in beta release).

@dpvc dpvc added Ready for Development Accepted Issue has been reproduced by MathJax team v3 Code Example Contains an illustrative code example, solution, or work-around labels Feb 24, 2025
@mzy0624 mzy0624 closed this as completed Feb 25, 2025
@mzy0624 mzy0624 reopened this Feb 25, 2025
@mzy0624
Copy link
Author

mzy0624 commented Feb 25, 2025

The problem has been solved, Thanks!

@mzy0624 mzy0624 closed this as completed Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Code Example Contains an illustrative code example, solution, or work-around Ready for Development v3
Projects
None yet
Development

No branches or pull requests

2 participants