Jump to content

Math Equation with Mathjax won't load next page tex


Ivan Wangsa

Recommended Posts

Hello, 
I'm running community with math involved and I upgraded to IPS4 this morning (before was 3.6.x).
I used mathjax before with almost no problem except with multi line tex. But with IPS4, I think I got several problem.

It's okay to load any post page. But when I load the next page or other page in the same topic, it didn't load the math equation script.

I don't know when I went wrong.

I put mathjax script in the head of global.

here's my global template

...
<head>
		<title>{expression="output.getTitle( $title )"}</title>
		<!--[if lt IE 9]>
			{{foreach \IPS\Theme::i()->css( 'extra/ie8.css', 'core' ) as $css}}<link rel="stylesheet" type="text/css" href="{$css}">{{endforeach}}
		    <script src="{url="applications/core/interface/html5shiv/html5shiv.js" base="none" protocol="\IPS\Http\Url::PROTOCOL_RELATIVE"}"></script>
		<![endif]-->
		{template="includeMeta" app="core" group="global" location="global" params=""}
		{template="includeMathJax" app="core" group="global" location="global" params=""}
		{template="includeCSS" app="core" group="global" location="global" params=""}
		{template="includeJS" if="theme.js_include != 'footer'" app="core" group="global" location="global" params=""}
		{template="favico" app="core" group="global" location="front" params=""}
	</head>
...

and includeMathJax template

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX", "output/HTML-CSS"],
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\\(","\\\)"] ],
      displayMath: [ ['$$','$$'], ["\\\[","\\\]"] ],
      multiLine: true,
      processEscapes: true
    },
    "HTML-CSS": { availableFonts: ["TeX"] }
  });
</script>
<script type="text/javascript"
   src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

 

Link to comment
Share on other sites

24 minutes ago, Tom S. said:

Looks like you've left out


</script>

after


<script type="text/javascript"
   src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">

 

sorry it's just typo in the post above,
I didn't left out the ending </script> in the actual file.

 

Link to comment
Share on other sites

+1.

The formulas are not displayed until refreshing the page.

I would like to know how to overcome this problem, too.

27 minutes ago, Flitterkill said:

Put it after the favico line in the header so it's the last thing in the header. As it is now, your js is loaded before all other js.

That will at least eliminate one possibility if it doesn't work.

Still not working.

Link to comment
Share on other sites

Smells like an ajax thing.

You can take this another level if you like. Remove the call from the header. Then pull up the includeJS template. It's located in core-global-global. At the very end of the template, after the closing {endif} paste in your script js call.

When you refresh the page, that loads in the global template again (with your called js file). With ajax new page load it bypasses reloading the global template leaving your math stuff wonky. 

What we are doing is testing the ajax new page routine to see if it pulls this template which loads in all the JS stuff for IPS. We paste your math call at the end so it tags along for the ride. If it does, you're set. Note - haven't looked myself as having you just try this is a lot faster than me looking at source code.

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...