MathJax in Blogger's Dynamic Views

982 views
Skip to first unread message

thedark...@gmail.com

unread,
Aug 10, 2012, 5:06:11 AM8/10/12
to mathja...@googlegroups.com
How do I implement MathJax in Blogger's Dynamic Views template?

Thomas Leathrum

unread,
Aug 10, 2012, 8:33:18 AM8/10/12
to mathja...@googlegroups.com, thedark...@gmail.com
On Friday, August 10, 2012 4:06:11 AM UTC-5, thedark...@gmail.com wrote:
> How do I implement MathJax in Blogger's Dynamic Views template?

I suspect what you need is a call to the MathJax Typeset() method, as suggested in the following documentation page:

http://www.mathjax.org/docs/2.0/typeset.html

I'm not familiar with Blogger, so I don't know where to put the call, but you should be able to play around with it some. The key will be to make sure that Typeset is queued when (or after) the View is displayed.

When you do get this worked out, please post what you did, so that others can read about it in the future.

Dr. Dayal D. Purohit

unread,
Aug 10, 2012, 12:20:11 PM8/10/12
to mathja...@googlegroups.com, thedark...@gmail.com
Check out  http://specialproductsexamples.blogspot.com/ and look into the source html.

You have to include some script first thing in the header by editing the html of the template.

d^3p

Peter Krautzberger

unread,
Aug 10, 2012, 12:39:45 PM8/10/12
to mathja...@googlegroups.com, thedark...@gmail.com
@thedarkjoker Could you provide a minimal example? I've seen these complicated new templates only once or twice, but not on mathematically-inclined blogs.

Peter. 

Christian Perfect

unread,
Aug 10, 2012, 1:26:10 PM8/10/12
to mathja...@googlegroups.com
It looks like the post gets loaded dynamically after the page loads, so the normal MathJax inclusion method won't work - MathJax gets loaded, but when it runs, the content isn't there. We need a way of hooking into blogger's javascript so we can run some code after the posts have been loaded. I'm looking into it.

cp

Christian Perfect

unread,
Aug 10, 2012, 2:17:43 PM8/10/12
to mathja...@googlegroups.com
Success! A few lucky guesses and a lot of staring at minified javascript sorted it out. I've updated my blog post with instructions on getting MathJax to work with the new blogger layout:  http://checkmyworking.com/2012/01/how-to-get-beautifully-typeset-maths-on-your-blog/#blogger 

I've just checked that it works with the one post I've got on my test blog, though If I've understood the code right, it should also work when you move to another post. Please tell me if it doesn't.

cp

Dr. Dayal D. Purohit

unread,
Aug 10, 2012, 2:31:40 PM8/10/12
to mathja...@googlegroups.com
I don't think it works when you navigate between posts. If you click the title of a past post, you will see the math rendered however.

Also comments won't show math as rendered. 

In my sample blog, everything works. Just take a look at the headers, specially the first script block.

d^3p

Christian Perfect

unread,
Aug 10, 2012, 2:40:26 PM8/10/12
to mathja...@googlegroups.com
d^3p, you're using the old Blogger theme. And you've just used the stock CDN loading code, which is what I built off.

cp

Peter Krautzberger

unread,
Aug 10, 2012, 8:40:29 PM8/10/12
to mathja...@googlegroups.com
@Christian,

awesome!

Peter.

Dr. Dayal D. Purohit

unread,
Aug 10, 2012, 10:39:21 PM8/10/12
to mathja...@googlegroups.com
Actually there is more to make sure navigation through past posts displays math and also that comments display math as well.

The script that you include is same for all blogspot templates I think except for the MathJax configuration.

Is navigation and comments working in your blog?

d^3p

thedark...@gmail.com

unread,
Aug 11, 2012, 3:22:06 AM8/11/12
to mathja...@googlegroups.com, thedark...@gmail.com
Thanks! The Typeset() method worked. 
Here are the steps to implement MathJax in Blogger's Dynamic Views:

vlad.s...@gmail.com

unread,
Oct 17, 2012, 3:58:50 PM10/17/12
to mathja...@googlegroups.com, thedark...@gmail.com
Thanks, this worked like a charm! Any idea how to get it to enable LaTeX in the comments as well?

jamie...@gmail.com

unread,
Nov 11, 2012, 6:31:49 PM11/11/12
to mathja...@googlegroups.com, thedark...@gmail.com
Struggling to get this to work. Can someone post a link to a blog where this has been correctly set up?

Christian Perfect

unread,
Nov 12, 2012, 6:34:58 AM11/12/12
to mathja...@googlegroups.com
A few people have been saying my code doesn't work. I think Blogger
changed something in their template system, but I don't have time to
look into it at the moment. If anyone does get it to work, please let
me know.

m.a.e.ab...@gmail.com

unread,
Feb 23, 2013, 1:43:30 PM2/23/13
to mathja...@googlegroups.com
 ?Chrisitian Perfect How you have MathJax on your sample blog  in Dynamic view , can I know please  

Thanks
Reply all
Reply to author
Forward
0 new messages