trouble with the MathJax object and basic javascript mechanics

30 views
Skip to first unread message

patchk...@gmail.com

unread,
Jun 19, 2016, 9:00:02 PM6/19/16
to MathJax Users
Dear MathJax Users,

I have been stumped by what seems like a very simple problem with MathJax and Javascript.  In a nutshell, the MathJax object which is created in the <head> element of my webpage doesn't seem to be accessible from a script called from the <body> of my webpage.  Here is a screenshot of my (very simple) .html file.  I have also included this file as an attachment to this email.


MathJax loads fine, and the formula in the body of my webpage renders great.  However the script on lines 25:27 returns "undefined" to the Google Chrome console.  I'm confused because it seems to me that the MathJax object created in the <head> of the webpage should be global, and accessible when I try to get to it on line 26.  When I replace the MathJax script on line 15 with a simple variable declaration, like var X = 5;, that variable shows up when I look for it on line 26.  This makes me think there's something fishy going on with the MathJax object.

(In case you are curious, my bigger objective is to successfully "modify math on the page" by calling MathJax.Hub.Queue(["Typeset",MathJax.Hub]); to typeset material loaded into the page with innerHTML.  I can't even begin to do this though because the MathJax object is "undefined".)

Thanks very much for any advice.  

cheers,
Patch
sample.html

Peter Krautzberger

unread,
Jun 20, 2016, 3:05:38 AM6/20/16
to mathja...@googlegroups.com
Hi,

As described in the MathJax User Group Guidelines, it is good etiquette to add references to duplicate postings on other forums.


Regards,
Peter.

--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Patch Kessler

unread,
Jun 20, 2016, 9:38:58 AM6/20/16
to mathja...@googlegroups.com
Thanks Peter, for answering my question on stackoverflow.  My apologies for the breach of etiquette!

cheers,
Patch

--
You received this message because you are subscribed to a topic in the Google Groups "MathJax Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mathjax-users/ztpVBfaBkV4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mathjax-user...@googlegroups.com.

Peter Krautzberger

unread,
Jun 20, 2016, 10:29:24 AM6/20/16
to mathja...@googlegroups.com
No problem. Glad it helped.

Regards,
Peter.
Reply all
Reply to author
Forward
0 new messages