MathJax in Blogger.com

97 views
Skip to first unread message

d^3p

unread,
Mar 31, 2011, 11:40:54 AM3/31/11
to mathja...@googlegroups.com
It seems to work. Thats what I thought.
 
It works on the home page. Then if you click older posts, you see math content as simple text. This has been observed in IE, Chrome, Safari, also in IE with MathPlayer.
 
And, if you have setup to archive in a certain way, each post has its own file name. And in that case, you can click the title of an entry and see the entry by its own. In that case you see the math content in that entry rendered, even though it was not displaying previously. Remove the MathJax code, and you see the blog working just fine with IE/MathPlayer.
 
No Problem with FireFox.
 
d^3p
 

Davide P. Cervone

unread,
Apr 2, 2011, 12:56:32 PM4/2/11
to mathja...@googlegroups.com
I do not see any problem with your Learning TeX blog. But there
doesn't seem to be an "older posts" link to click, so perhaps I'm not
seeing the behavior you observed.

On the other hand, you say that if you remove the MathJax code then IE/
MathPlayer "works fine", but I don't see how that can be, since there
is no MathML in the page, only TeX code, which MathPlayer doesn't
use. Are you sure you have been getting the correct versions (non-
cached) of the pages you are testing? The reported behavior doesn't
seem consistent to me.

Davide

d^3p

unread,
Apr 2, 2011, 1:16:49 PM4/2/11
to mathja...@googlegroups.com
I had to remove the navigation because of the issue I had described. If you click an archived blogentry, one has to click  the title of an entry to view it. And thats the only one could view math content if navigation had been enabled. So, I thought that would be one solution.
 
As for IE/MathPlayer, thats in another blog for one of my class. The LearningTex does not have the proper code to kick start MathPlayer  anyway.
 
Here is the link to the blogpost where I have a screen shot of Safari 5 displaying the Fraktur letetrs. Safari 5 display of Fraktur letters
 
Thanks,
 
d^3p

Davide P. Cervone

unread,
Apr 2, 2011, 1:24:13 PM4/2/11
to mathja...@googlegroups.com
I had to remove the navigation because of the issue I had described. If you click an archived blogentry, one has to click  the title of an entry to view it. And thats the only one could view math content if navigation had been enabled. So, I thought that would be one solution.

Can you re-enable the navigation so I can test it out?  It may have to do with how the older posts are shown.  If they are added to the page dynamically (rather than loading a new page), then you would have to tie into that mechanism to call MathJax's API to reprocess the page.  Otherwise, there is no way for MathJax to know that the page has been altered and needs updating.

As for IE/MathPlayer, thats in another blog for one of my class. The LearningTex does not have the proper code to kick start MathPlayer anyway.

OK.


Here is the link to the blogpost where I have a screen shot of Safari 5 displaying the Fraktur letetrs. Safari 5 display of Fraktur letters

Sorry, wasn't aware this was the Windows version of Safari.  I'll have to check that.  I was using OS X Safari.

Davide

d^3p

unread,
Apr 2, 2011, 1:36:58 PM4/2/11
to mathja...@googlegroups.com
Ok. I have changed the template and reinserted the MathJax code. And, you can now see it is displaying fine the first 4 entries. I was wrong about the blackboard capitals. Some of them are not showing.
 
Now, if you navigate to next set of entries, you will not see math. But, if you click the entry's title, the entry opens in its archived page and it displays math.
 
Thanks,
 
d^3p

Davide P. Cervone

unread,
Apr 2, 2011, 1:51:36 PM4/2/11
to mathja...@googlegroups.com
Right, I see the issue with the older links. It looks like blogger is
not loading a new page but is dynamically inserting the older text
into the page. That will not trigger MathJax to run again, so you
would need to hook into that mechanism yourself.

Are you able to include javascript in your blog posts? If so, you
could add

<script>MathJax.Hub.Queue(["Typeset",MathJax.Hub])</script>

at the end of every post, so when it is displayed, it will cause
MathJax to run again. That might work, depending on how the text is
inserted into the page. IE might be a problem.

Alternatively, you might need to add some javascript to your template
to trap the "older posts" link in order to hook into the process of
loading the past posts. Something like

<script>
MathJax.Hub.Queue(function () {
var older = document.getElementById("Blog1_blog-pager-older-link");
var original_onclick = older.onclick; // save old function
older.onclick = function () {
original_onclick.apply(this,arguments); // call original onclick
action
MathJax.Hub.Queue(
["Delay",MathJax.Hub,500], // give the original action time to
finish
["Typeset",MathJax.Hub] // re-typeset the page
);
}
});
</script>

which is completely untested, might work, or could serve as a starting
point for you.

Davide

dayalp...@gmail.com

unread,
Apr 2, 2011, 2:05:19 PM4/2/11
to mathja...@googlegroups.com
I am not sure, but I think I should be able to include script. I know for sure one can include a gadget that includes script.

I will try both techniques and see where I succeed and let you know. To tell the truth I had been working on the second technique for quite sometime but have not been able to find the right place to insert the code.

Thanks,

d^3p

On Apr 2, 2011 1:51pm, "Davide P. Cervone" <dp...@union.edu> wrote:
> Right, I see the issue with the older links.  It looks like blogger is not loading a new page but is dynamically inserting the older text into the page. That will not trigger MathJax to run again, so you would need to hook into that mechanism yourself.
>
>
>
>
>
> Are you able to include javascript in your blog posts?  If so, you could add
>
>
>
>
>
>        MathJax.Hub.Queue(["Typeset",MathJax.Hub])script>
>
>
>
>
>
> at the end of every post, so when it is displayed, it will cause MathJax to run again.  That might work, depending on how the text is inserted into the page.  IE might be a problem.
>
>
>
>
>
> Alternatively, you might need to add some javascript to your template to trap the "older posts" link in order to hook into the process of loading the past posts.  Something like
>
>
>
>
>
>        
>
>
>        MathJax.Hub.Queue(function () {
>
>
>          var older = document.getElementById("Blog1_blog-pager-older-link");
>
>
>          var original_onclick = older.onclick;  // save old function
>
>
>          older.onclick = function () {
>
>
>            original_onclick.apply(this,arguments); // call original onclick action
>
>
>            MathJax.Hub.Queue(
>
>
>              ["Delay",MathJax.Hub,500],  // give the original action time to finish
>
>
>              ["Typeset",MathJax.Hub]      // re-typeset the page
>
>
>            );
>
>
>          }    
>
>
>        });
>
>
>        
>
>
>
>
>

d^3p

unread,
Apr 2, 2011, 3:48:12 PM4/2/11
to mathja...@googlegroups.com
Fantastic. The second trick did it. The first did not work. Now, I can navigate back and forth.
 
I added the script to top where I had the preference for the fonts. That is right after the <head> before the loading the MathJax.
 
I just have to find the key id if using a different template. The id name may be same but I know these blogger templates vary so much.
 
Thanks,
 
d^3p

Davide P. Cervone

unread,
Apr 2, 2011, 4:28:31 PM4/2/11
to mathja...@googlegroups.com
Glad it worked for you. But I'm a little concerned about where you
have placed it. Since it relies on MathJax, it either has to come
after the script that loads MathJax (so that the MathJax variable will
be defined) or you need to make it

<script type="text/x-mathjax-config">
...
</script>

so that it will not run until MathJax performs its configuration.

Davide

d^3p

unread,
Apr 2, 2011, 5:00:12 PM4/2/11
to mathja...@googlegroups.com
It does not work if I put the code after the loading of MathJax.
 
Its working fine if I put the code before. I have checked it in now 2 blogs. One has very small amount tex in each entry unlike in learning tex blog, specially in the latest few.
 
Thanks,
 
d^3p
Reply all
Reply to author
Forward
0 new messages