-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Incorrect rendering hidden formula #1179
Comments
I use MathJax to create online mathematics lectures. The content is timed with audio, and thus is initially hidden. Our department is experiencing the same problem (0 width given to math when it appears). This is an urgent issue for us, as several of our math courses use this technique, and these classes are starting Monday. @scaljeri, I think the demo you posted in your other issue better illustrated the problem: |
I've, for now, solved it by going back to 2.4-latest
Although our testers still have to verify that this actually works with our formula's it seems to work pretty wel! And, serving the code of tag 2.5.1 yourself will work as wel (but is for me more work) |
Thanks for reporting this separately and creating the minimal samples. We're looking into it. |
I have a large probability/statistics site in which proofs of theorems and solutions to exercises are initially hidden, so this is an urgent issue for me also. The problem exists for content hidden via the HTML element (supported in Chrome and Safari) and for content hidden via CSS (as noted already).
|
In the last post, I meant the HTML 5 details-summary element. |
…iv where they are typeset to their proper locations until AFTER they have been remeasured. Resolves issue mathjax#1179.
In general, using MathJax to process math inside a container that has That being said, some optimizations introduced in 2.5 and updated in 2.5.2 did interfere with MathJax's process for handling this situation. The |
I downloaded that branch and tried it. I am still getting the same problem as before. |
@smtosh, the branch only includes the unpacked version at the moment, so make sure you insert |
I added that in, and it looks like the fix worked from my end! |
Great! Thanks for the confirmation. |
==> Test Available. |
Two quick questions:
|
The test file is in the MathJax-test repository, and is only really usable within that framework. It is not easy to set up and run, but you are welcome to do so if you want. This specific test file simply typesets the same equation in two different divs, one with |
I'm in the processes of running the test suite, and if all goes well, it is possible that the release could be made tomorrow (though Peter is the one to make that call). |
PS, if the problem is the |
@smtosh wrote
You might want to consider switching to |
=> Fixed and merged. |
Thank you so much for being so efficient in getting this bug fixed! It is much appreciated. |
Yes, Thanks so much for the quick action! On Fri, May 1, 2015 at 5:28 AM, smtosh notifications@github.com wrote:
Kyle Siegrist |
No problem. Just to be sure: it's still bad practice to use |
Is there any change that this |
You can certainly add
There are two important factors involved here. The first is that moving the math to another relocation means that the next time MathJax takes a measurement, the browser has to reflow the page, so each equation that is in a container with It turns out that I was able to resolve this issue in the 2.5.3 release by moving such math elements all at the same time (so only one reflow occurs). That was not the case prior to 2.5.3. So the performance problem is resolved. The other factor is that MathJax needs to match the size of the font at the location in the page where the math is to be typeset, and to do so, it must determine the ex-height of the surrounding font. It does that by measuring an element with size given in units of It might be possible to look up the font information from the original location and transfer that along with the math when it is moved, but some older browsers that are still supported by MathJax can't do that, so it would mean dropping support for them (or having to handle them as special cases). The other approach would be to be less reliant on measuring the results. We are working on a new output format that is browser and platform independent, and this output does not rely on taking measurements like the current HTML-CSS output does, so can be transferred from place to place more easily. It still does need to determine the ex-height, however, so So the the short answer (after this long one) is "no" at least in the short term, but perhaps "yes" in the longer term. |
thanks a lot for the detailed explanation! |
Now that CommonHTML output exists, is it less dependent on layout measurements? |
@cben, the CommonHTML output does not rely on measuring the subexpressions, as the HTML-CSS output did. It does, however, still need to measure the ex-height of the surrounding font, and the width available for line breaking purposes, and in the case that you use characters that aren't in the MathJax fonts, CommonHTML still needs to measure those. So yes, it is less dependent on measurements, but not completely measurement free. |
When a formula initially is hidden (
display: none
) MathJax renders the formula with an incorrect width.DEMO: http://jsfiddle.net/1hLvdbm2/2/
This problem only seems to happen in v2.5.2. If I run the same demo agains 2.4-latest it works as expected
DEMO: http://jsfiddle.net/1hLvdbm2/3/
The text was updated successfully, but these errors were encountered: