MathJax freezes whole browser

349 views
Skip to first unread message

Mitar

unread,
Sep 25, 2011, 7:03:40 AM9/25/11
to mathja...@googlegroups.com
Hi!

In the attached example, when loading in the Firefox, Firefox freezes.
Chrome behaves better and only a tab freezes (and it gives you a
warning after some time about that and an option to kill it).

I have tested on Chrome 14.0.835.186 and Firefox 4.0.1.

I think this is a bug. Nothing should freeze whatever I do in HTML
code. (But I do nothing special, I just try to configure MathJax.)


Mitar

Mitar

unread,
Sep 25, 2011, 7:07:38 AM9/25/11
to mathja...@googlegroups.com
Hi!

Of course it is good to attach something. ;-)


Mitar

freeze.html

Mitar

unread,
Sep 25, 2011, 10:01:13 AM9/25/11
to mathja...@googlegroups.com
Hi!

So the question it seems is: how to properly disable any inline or
block parsing? Setting params to empty list has bad consequences.


Mitar

Davide P. Cervone

unread,
Sep 27, 2011, 7:47:43 AM9/27/11
to mathja...@googlegroups.com
I'm glad you figured out it was the empty inline and display delimiter
lists (this ends up causing MathJax to create an empty pattern for its
search testing, and that matches EVERYTHING, so it loops forever
trying to add empty math equations to the page).

The usual way to prevent the tex2jax from running is to not load it in
the first place. Of course, if you are using a combined configuration
file that already includes tex2jax, that is harder. If you are not
using TeX input at all (but just MathML), then you could load the
MML_HTMLorMML configuration file instead, which does not include the
tex2jax extension. If you actually ARE using TeX input but are
marking the mathematics "by hand" (programmatically), then you could
use a custom configuration that loads the TeX input jax and either the
HTML-CSS output jax or the MMLorHTML configuration file, but that
doesn't load the tex2jax extension. It would also be possible to make
a custom combined configuration file, but that would take a little
more work.

Finally, if you really must load the tex2jax extension as part of a
combined configuration file, then you can disable it by setting the
skipTags list ["body"] via custom configuration like the following:

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: { skipTags: ["body"] }
});
</script>

This will cause tex2jax to skip the <body> element when preprocessing
the page.

Davide

Mitar

unread,
Sep 27, 2011, 11:04:49 AM9/27/11
to mathja...@googlegroups.com
Hi!

On Tue, Sep 27, 2011 at 1:47 PM, Davide P. Cervone <dp...@union.edu> wrote:
> If you are not using TeX input at all (but just MathML),

I am using TeX input, but I am using <script type="text/math"> for it
(it is rendered that way programmatically).

I am not sure if I understand, I though that there is no difference
between "configuration that loads the
TeX input jax" and "tex2jax extension"? Or are those two different
things/extensions?

How would I make a custom configuration the way you described?

I will then probably go for body exclusion. But still, I would argue
that it would be best if MathJax would check the inline and display
delimeters and if empty, disable them. I think this is the most normal
way to disable: just saying that you do not want any.

Thanks for explanation and help.


Mitar

Davide P. Cervone

unread,
Sep 27, 2011, 8:15:40 PM9/27/11
to mathja...@googlegroups.com
> I am using TeX input, but I am using <script type="text/math"> for it
> (it is rendered that way programmatically).

It should be <script type="math/tex">...</script> for in-line math,
and <script type="math/tex;mode=display">...</script> for display math
in order for MathJax to recognize it.

> I am not sure if I understand, I though that there is no difference
> between "configuration that loads the TeX input jax" and "tex2jax
> extension"? Or are those two different
> things/extensions?

The TeX input jax and the tex2jax extension are two different things.
The TeX input jax is the component of MathJax that processes the
contents of the scripts with type="math/tex" like those described
above. It only looks for those types of script tags. The tex2jax
preprocessor is the component that looks through the text of the page
for math delimiters and put the mathematics into script tags with
type="math/tex" so that the TeX input jax will find them.

You can use the TeX input jax without the tex2jax preprocessor, which
is what you should do in your case. Since the tex2jax preprocessor is
included in all the combined configuration files that are provided on
the CDN, however, you will need to use a custom configuration to avoid
loading it.

> How would I make a custom configuration the way you described?

Add something like

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
config: ["MMLorHTML.js"],
jax: ["input/TeX"],
TeX: { extensions: ["AMSmath.js","AMSsymbols.js"] }
});
</script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js
"></script>

Note that you do NOT include a "config=" parameter when you load
MathJax.js in this case. See

http://www.mathjax.org/docs/1.1/configuration.html#using-in-line-configuration-options
and
http://www.mathjax.org/docs/1.1/options/index.html

for more details about configurations.

> I will then probably go for body exclusion.

If you use the above, you won't have to, since tex2jax will not run,
because it is not included.

> But still, I would argue
> that it would be best if MathJax would check the inline and display
> delimeters and if empty, disable them. I think this is the most normal
> way to disable: just saying that you do not want any.

Certainly it should not look forever. I will have to fix that, at
least.

Davide

Mitar

unread,
Sep 27, 2011, 8:52:21 PM9/27/11
to mathja...@googlegroups.com
Hi!

On Wed, Sep 28, 2011 at 2:15 AM, Davide P. Cervone <dp...@union.edu> wrote:
> It should be <script type="math/tex">...</script> for in-line math, and
> <script type="math/tex;mode=display">...</script> for display math in order
> for MathJax to recognize it.

This was a typo on my part.

> Add something like
>
>        <script type="text/x-mathjax-config">
>        MathJax.Hub.Config({
>          config: ["MMLorHTML.js"],
>          jax: ["input/TeX"],
>          TeX: { extensions: ["AMSmath.js","AMSsymbols.js"] }
>        });
>        </script>
>        <script type="text/javascript"
> src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
>
> Note that you do NOT include a "config=" parameter when you load MathJax.js
> in this case.  See

Thanks!


Mitar

Mitar

unread,
Sep 27, 2011, 9:11:22 PM9/27/11
to mathja...@googlegroups.com
Hi!

On Wed, Sep 28, 2011 at 2:15 AM, Davide P. Cervone <dp...@union.edu> wrote:
> Note that you do NOT include a "config=" parameter when you load MathJax.js
> in this case.

I am getting this error:

MathJax no longer loads a default configuration file; you must specify
such files explicitly. This page seems to use the older default
config/MathJax.js file, and so needs to be updated. This is explained
further at

http://www.mathjax.org/help/configuration

I configured it like this;

MathJax.Hub.Config({'tex2jax': {
'config': [
'MMLorHTML.js'
],
'jax': [
'input/TeX', ''input/MathML', 'output/HTML-CSS', 'output/NativeMML'
],
'TeX': {
'extensions': [
'AMSmath.js', 'AMSsymbols.js', 'noErrors.js', 'noUndefined.js'
]
}
}});

I am also using delayStartupUntil=configured and I run
MathJax.Hub.Configured() manually.


Mitar

Davide P. Cervone

unread,
Sep 27, 2011, 11:09:32 PM9/27/11
to mathja...@googlegroups.com
> I configured it like this;
>
> MathJax.Hub.Config({'tex2jax': {

The

'tex2jax': {

in the previous line is the problem. Remove it (and the corresponding
close brace at the end) and all should be well. The reason you are
getting the error message is because all of your configuration has
gone into the 'tex2jax' section, and so there is no jax (or other
arrays) in the main part of the configuration, and MathJax uses the
presence of the jax array to determine if the configuration has been
completed.

> 'config': [
> 'MMLorHTML.js'
> ],
> 'jax': [
> 'input/TeX', ''input/MathML', 'output/HTML-CSS', 'output/NativeMML'
> ],
> 'TeX': {
> 'extensions': [
> 'AMSmath.js', 'AMSsymbols.js', 'noErrors.js', 'noUndefined.js'
> ]
> }
> }});
>
> I am also using delayStartupUntil=configured and I run
> MathJax.Hub.Configured() manually.

The rest should be fine.

Davide

Reply all
Reply to author
Forward
0 new messages