• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

MathJax supports on Xenforo

Andy.N

Well-known member
#1
I'm trying to get MathJax to work on XF
http://www.mathjax.org/docs/2.0/start.html

So, according to the doc, I'm adding this script to the page_container_js_head template
Code:
<script type="text/javascript"
  src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG">
</script>
I'm using TeX-AMS-MML_SVG because I want to use the SVG output engine so that the formula will scale.

Now, I'm not sure what to do next. Do I put the math equation between $$ .... $$ or \[ ... \]?
I tried that and nothing happens.

I currently have a bbcode [tex] that connect to a cgi script that produces png images for the formula. How can I modify this [tex] bbcode to use the new MathJax script.

Thank you.
 

Jake Bunce

XenForo moderator
Staff member
#2
You would have to edit the replacement for the BB code to include those $$ or \[ delimiters. If it's a media site then the replacement can be edited in your:

Admin CP -> Home -> BB Code Media Sites
 

Andy.N

Well-known member
#3
You would have to edit the replacement for the BB code to include those $$ or \[ delimiters. If it's a media site then the replacement can be edited in your:

Admin CP -> Home -> BB Code Media Sites
It works !!!
I use \[ and \] and begin and end replacement.
Thanks Jake.

Somehow the SVG output does not work. If you go here, you will see the page loads the MathJax JS but it does not render SVG images. If you right click on the output under the formula on the first post and select Math Setting ->Math renderer to HTML-CSS, it will appear fine.

I thought SVG is supported by most browser. Our site logo is SVG and it displays fine. Is there anything we need to do on the bbcode [latex] to use for SVG?

Thanks again.
 

RobinHood

Well-known member
#7
Ahh yeah, I just had a look, the svg option doesn't seem to work for me, it only partially displays. Looks good in HTML-CSS though, is there really an advantage of using the SVG renderer as isn't the HTML-CSS output still vector ?
 

RobinHood

Well-known member
#10
Hmm..yeah it doesn't render in SVG for me on your site in Chrome of FF. It's not because it's an old thread and the code is slightly different perhaps?

It works for me on the mathjax link you posted. The SVG text looks like a bold version of the css version. I'm not sure if it's an illusion due to the bolding, but the css version looks way sharper to me on my 2560x1440px screen
 

Andy.N

Well-known member
#11
Hmm..yeah it doesn't render in SVG for me on your site in Chrome of FF. It's not because it's an old thread and the code is slightly different perhaps?

It works for me on the mathjax link you posted. The SVG text looks like a bold version of the css version. I'm not sure if it's an illusion due to the bolding, but the css version looks way sharper to me on my 2560x1440px screen
The mathjax is loading from their CDN so it always loads the latest version of JS.
On my retina screens, SVG looks much sharper but on regular screens, CSS is fine.
 

RobinHood

Well-known member
#12
Soo...just looking at their site. You can use the mathjax CDN to run this on a site without having to install in directly on your serve? Is that what you've done? I'd quite like to get this setup myself.
 

Andy.N

Well-known member
#13
There is nothing to install on your site. Put their CDN javascript on the js_head template, make a bbcode (I use [tex]) and use it.
Btw, what type of site you run? Why you need it?
 

RobinHood

Well-known member
#14
Ahh brilliant, I'll give that a shot tomorrow. Do you provide your users with some sort of guide on how to create equations easily with it?

I'm working on launching a local education site shortly and some of the users will be mathematics and engineering students, so this could potentially be very useful to them.