Fraction width sometimes not correct in Google Chrome

262 views
Skip to first unread message

Max Cohen

unread,
Feb 29, 2012, 10:11:24 AM2/29/12
to mathja...@googlegroups.com
Hi,

A fraction displayed in Chrome (version 17.0.963.56 m) sometimes loads with a graduation line that is too wide.
The tex input is:
\frac{1}{\mathrm{123\; 456\; 789}}

I´m not sure if it´s related, but when the math loads correctly. the console reports:
Resource interpreted as Font but transferred with MIME type application/octet-stream: "http://localhost/sowisoplayer/MathJax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff".
Resource interpreted as Font but transferred with MIME type application/octet-stream: "http://localhost/sowisoplayer/MathJax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Bold.woff".

When the math does not load correctly it does not always report these warnings.

If you want, I can report it as a bug.

regards,
Max

grad_line.gif

Davide P. Cervone

unread,
Mar 2, 2012, 11:13:02 AM3/2/12
to mathja...@googlegroups.com
Max:

The errors are due to the fact that your server is sending the fonts with the "wrong" MIME-type.  Chrome is using them as fonts anyway, but you could configure your server to use font/woff rather than application/octet-stream for .woff file, and I think that would take care of the problem.

It sounds like this is an intermittent problem?  When it occurs, will you enter

javascript:alert(MathJax.Message.Log())

in the URL location type-in and let me know whether there are any "Failed to load" message?

Finally, are you dynamically revealing the mathematics, or is it part of a static page?

Davide



<grad_line.gif>

Max Cohen

unread,
Mar 3, 2012, 6:42:12 PM3/3/12
to mathja...@googlegroups.com
Hi Davide,

To get rid of the warnings in Chrome, I tried several addTypes for mime type .woff, none with succes; the warning of type application/octet-stream stayed.
(I'm using apache 2.2)

The problem seems to occur randomly. The source page is created dynamically with apache tomcat (linked with ajp proxy; redirected from apache httpd), but in this test case the source of it remains the same.
The source of the part concerning the problem is:
<div style="color:black;background-color:white;font-size:16px;">
  <script type="math/tex">\frac{1}{\mathrm{123\; 456\; 789}}</script>
</div>

I attached the javascrpit alert response, but can't see anything strange there.

I'm not sure if this helped. Let me know if I can do anything else.
Here's a live link that might help to ananlyze the problem?
http://www.wiskundeschool.nl/sowisoplayer/tests/mspace.xml

thanks,
Max
javascript_alert.gif

Davide P. Cervone

unread,
Mar 11, 2012, 4:45:44 PM3/11/12
to mathja...@googlegroups.com
> To get rid of the warnings in Chrome, I tried several addTypes for
> mime type .woff, none with succes; the warning of type application/
> octet-stream stayed.
> (I'm using apache 2.2)

Have you tried adding

AddType font/x-woff .woff

to your configuration? That should do it, I think.


> The problem seems to occur randomly. The source page is created
> dynamically with apache tomcat (linked with ajp proxy; redirected
> from apache httpd), but in this test case the source of it remains
> the same.

Did you restart the server after making the .htaccess change? If you
have persistent httpd children, then this is important, and when you
say the problem seems random, then that makes me think that some of
the children have the new .htaccess and some are using the old one
(that is one way I've seen that in the past).

> The source of the part concerning the problem is:
> <div style="color:black;background-color:white;font-size:16px;">
> <script type="math/tex">\frac{1}{\mathrm{123\; 456\; 789}}</script>
> </div>

Is the math part of the page originally, or is it dynamically added to
the page? Does it start out hidden and then get revealed? The latter
in particular can cause sizing problems, and there are some ways to
deal with that.

Can you send me a URL for the page that exhibits this problem for you?

Davide

Max Cohen

unread,
Apr 3, 2012, 7:20:53 AM4/3/12
to mathja...@googlegroups.com
 Hi Davide,

The link of a page where I get the strange faction layout is:

regards,
I´ll look into you other suggestions later.
regards,
max

Davide P. Cervone

unread,
Apr 4, 2012, 11:18:18 AM4/4/12
to mathja...@googlegroups.com
I am not able to reproduce the problem (and don't seem to get the font error messages that you are seeing).

I do notice that the fraction line shows up before the digits do, which has me concerned.  They should show up at the same time.  The fact that they aren't suggests that MathJax is not properly detecting the presence of the web fonts (that is a rather fragile bit of code), and may be typesetting the equations before the fonts are really available, and so getting the widths wrong (the browser usually uses a default font of some sort until the web fonts actually arrive).  I know that has been a problem with WebKit-based browsers in the past, but thought I had taken care of it in v2.0.  Apparently there is still more to do.

I will look into it some more.  Once the fonts are cached, they usually work fine, so reloading the page often will resolve the issue, and it is usually only a problem on the first page loaded from a given site.

I noticed that you are running the initial v2.0 files, and have not gotten the (few) updates that have occurred since the v2.0 release.  You should be sure to get the v2.0-latest branch if you used git, or 


if you got a zip file from GitHub.

I also noticed that you have modified the TeX-AMS_HTML configuration file.  That is probably a bad idea, as it make it harder to update your copy of MathJax, and makes it harder for me to diagnose the problems you are having (it took me more than half an hour to figure out why your copy of MathJax wasn't responding the way I expected it to before I realized that you had edited the files).  MathJax provides several methods of altering the configuration other than editing the distribution itself, and I recommend that you use those instead.  For example, the changes you made could be handled by adding

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  messageStyle: "none",
  "HTML-CSS": {
    availableFonts: [],
    scale: 110,
    showMathMenu: false
  }
});
</script>

to your web page template above the script call that laos MathJax.js.  This will isolate your changes from the code itself, making it easier to update your copy of MathJax, and will make it clear what changes you have made in case anyone else (e.g., me) has to look at the site.

Davide

Max Cohen

unread,
Apr 5, 2012, 4:45:06 AM4/5/12
to mathja...@googlegroups.com
Hi Davide,

Thanks for your analyses and my apologies for the hacked config.
I took your advice and now use the local.js for my custom configuration.

I did not update to the latest version because this is a live website and thought that v2.0-latest may not be that stable. Am I wrong?

The fraction line also shows up earlier on my screen. The strange thing is that on another computer I also cannot reproduce the issue.
I implemented the mime type as you suggested, but now get the warning on the new mime type setting (only upon first load).
Resource interpreted as Font but transferred with MIME type font/x-woff: "http://www.wiskundeschool.nl/sowisoplayer/MathJax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff".
Resource interpreted as Font but transferred with MIME type font/x-woff: "http://www.wiskundeschool.nl/sowisoplayer/MathJax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Bold.woff".
Resource interpreted as Font but transferred with MIME type font/x-woff: "http://www.wiskundeschool.nl/sowisoplayer/MathJax/fonts/HTML-CSS/TeX/woff/MathJax_Math-Italic.woff".
Resource interpreted as Font but transferred with MIME type font/x-woff: "http://www.wiskundeschool.nl/sowisoplayer/MathJax/fonts/HTML-CSS/TeX/woff/MathJax_Size1-Regular.woff".


Although the .woff fonts are cached, the issue with the fraction line does not go away.

Let me know if I can be of any more help.

regards,
Max

Davide P. Cervone

unread,
Apr 5, 2012, 10:55:04 AM4/5/12
to mathja...@googlegroups.com
Thanks for your analyses and my apologies for the hacked config.
I took your advice and now use the local.js for my custom configuration.

Ok, glad that is working for you.

I did not update to the latest version because this is a live website and thought that v2.0-latest may not be that stable. Am I wrong?

Actually,v2.0-latest is more stable than master.  The v2.0-latest branch includes some important fixes that came up in the week or so after the v2.0 release, but master can include additional code that is being developed toward the next release (so can be less stable, though in practice it usually is pretty solid).

The fraction line also shows up earlier on my screen. The strange thing is that on another computer I also cannot reproduce the issue.
I implemented the mime type as you suggested, but now get the warning on the new mime type setting (only upon first load).
Resource interpreted as Font but transferred with MIME type font/x-woff: "http://www.wiskundeschool.nl/sowisoplayer/MathJax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff".
Resource interpreted as Font but transferred with MIME type font/x-woff: "http://www.wiskundeschool.nl/sowisoplayer/MathJax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Bold.woff".
Resource interpreted as Font but transferred with MIME type font/x-woff: "http://www.wiskundeschool.nl/sowisoplayer/MathJax/fonts/HTML-CSS/TeX/woff/MathJax_Math-Italic.woff".
Resource interpreted as Font but transferred with MIME type font/x-woff: "http://www.wiskundeschool.nl/sowisoplayer/MathJax/fonts/HTML-CSS/TeX/woff/MathJax_Size1-Regular.woff".



OK, according to this link


the MIMETYPE should be "application/x-font-woff" and it will eventually be "application/font-woff".  There are other suggestions there, so you may want to try them out if that doesn't work.

Although the .woff fonts are cached, the issue with the fraction line does not go away.

I will have to look into it further.

Davide

Reply all
Reply to author
Forward
0 new messages