MathJax and Graphing Notation Options

1,109 views
Skip to first unread message

r2d2

unread,
Feb 5, 2013, 11:17:42 AM2/5/13
to mathja...@googlegroups.com
Dear MathJax Group,

Is is possible to implement the ASCIIMath graphing notation using the MathJax javascript? The legibility of MathJax notation is really super and would prefer using it to graph equations. Thank you.

Example ASCIIMath Graphing notation:
\begin{graph} width=480; height=320; xmin=-6.3; xmax=6.3; xscl=1; plot(cos(log(x))); plot(2.2sin(x)) \end{graph}

Thomas Leathrum

unread,
Feb 6, 2013, 11:54:30 AM2/6/13
to mathja...@googlegroups.com
I don't know of anyone working to get MathJax working with this ASCIIMath Graphing package, but I do know that some good work has been done to get MathJax working with XY-Pic -- here is a link:

https://github.com/sonoisa/XyJax

And with JSXGraph -- again, here is a link:

http://jsxgraph.uni-bayreuth.de/wiki/index.php/Using_MathJax

The idea of getting MathJax working with the ASCIIMath Graphing package certainly looks interesting, feasible, and worth pursuing.  Perhaps this discussion will catch the eye of someone who can do the coding.  I'm not familiar with the ASCIIMath Graphing package, but I'll give it a quick look to see how involved the coding might be.

Thomas Leathrum

unread,
Feb 6, 2013, 5:38:31 PM2/6/13
to mathja...@googlegroups.com
A bit closer to what you asked about originally: I have gotten MathJax-rendered labels working in Peter Jipsen's ASCIIsvg, but I had to add a method to the original ASCIIsvg.js script to add support for SVG foreignObject elements. I am planning to post this on my github soon (as soon as I clean the code up a bit), and I will put a post in this group with links when I do.

r2d2

unread,
Feb 7, 2013, 11:05:28 PM2/7/13
to mathja...@googlegroups.com

Thank you for looking into the question. Kudo's to Jipsen for working on a simple syntax and making the javascript open-source.

Question #2
Among the javascript graphing packages: ASCIIsvg, XyJax, and JSXgraph which script will more easily allow other mathematicians and scientists to fact check the math that generated the graph?

Peter Krautzberger

unread,
Feb 8, 2013, 12:18:34 AM2/8/13
to mathja...@googlegroups.com
A question for those more knowledgeable: is asciiSVG syntax following "standards" in some sense? That is, how reusable is the source?

If somebody wrote a proper MathJax extension, then MathJax's "show source" functionality would be naturally useful. But mostly if the format was reusable in other systems (sage, mathematica etc).

Just curious, I know very little about CAS systems.

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/groups/opt_out.
 
 

Marc Grober

unread,
Feb 8, 2013, 2:31:59 AM2/8/13
to mathja...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ASCIISVG is an easily used and deployed script and as it was packaged
wth ASCIIMath was a simply incredible resource. However, jsxgraph has
the ability to produce files that are usable with other applications,
so as you might see in Mauno's SEE plugins for Moodle, one can use a
gui to create graphs, save as various types of files and then open
later, which makes it possibly best of breed at the moment.
> -- 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/groups/opt_out.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQEcBAEBAgAGBQJRFKnvAAoJEMCi9wxDaNqEvCUH/3nZKSejtwJHINnDR8IEx8QS
TQapJk3Ixy0xcawaDUfyhQp1U912abM1uJcpTN1r/c4odbGUTQT/BZuQcgzdwfYO
gY9i2o2ERZOhWYoCmDE5nH5ZQqbBmdP1BWb15OT9UHFAUkXBkkG1Ee0RNAFWwXGm
cnXkGtD9bj5NVkOSa9DxFCsqYznRj+sSGXgcri2zvOW3JuT1w0W7hY6Te7BUPBu6
pqQN1UthPjMdk2enkuLyQxCWVOZlaA6nT4uUb8+LTq+MskVht3onlO1FGqe3PNi+
Epu4q5Ht8axMyWK/TfmNg5aaxlIcNsxryGm3YA5585Tt03T9ZoWb8WJRdlIQMho=
=RUNR
-----END PGP SIGNATURE-----

Thomas Leathrum

unread,
Feb 8, 2013, 9:09:43 AM2/8/13
to mathja...@googlegroups.com
I can speak to some of these questions. I am not as familiar with XYJax, but I know enough about JSXGraph and (now) ASCIIsvg to give some info about them.

Both JSXGraph and ASCIIsvg (or, more to the point, the current ASCIIMathML graphing routines) use a JavaScript-based syntax, including for the math expressions entered in plotting commands, but both offer some enhancements to this syntax, so that for example you can use "cos(x)" instead of "Math.cos(x)" and "x^3" instead of "Math.pow(x,3)" or "x*x*x". This enhanced syntax is intended to be calculator-based, but I hesitate to call it "standard" because there is no standard here. In the CAS world, there are significant differences, even at this level, between Maple and Mathematica syntax.

More interesting to me is the output format. Again, I can't speak with any authority about XYJax, but I do know how JSXGraph and ASCIIMathML graphing handle their output. JSXGraph is browser-aware and adapts its output to the capabilities of the browser, but notably has output modes for both HTML5 canvas and SVG. ASCIIMathML graphing routines are derived from ASCIIsvg which, as the name suggests, is intended to abbreviate SVG, albeit with some enhancements such as a "plot(...)" command so that you don't have to generate paths by hand, so its output is pure SVG. SVG is widely reusable -- it can be pasted into image manipulation software such as GIMP. SVG is also supported by ePub3.

As for getting these graphing routines working as MathJax input, I think the model we see already from JSXGraph and XYJax is more appropriate: make sure that MathJax can be used in appropriate places within the graphing libraries. I think including these as input for MathJax would bloat the MathJax library. I am working on getting MathJax working within ASCIIsvg, and have had some success, including with the newer graphing routines in ASCIIMathML -- the biggest problem I am having is with dynamically resizing the SVG foreignObject based on the size of the rendered MathJax (Davide -- if you are following this thread, expect an e-mail from me about this sooon).

Thomas Leathrum

unread,
Feb 8, 2013, 9:58:40 AM2/8/13
to mathja...@googlegroups.com
If you want to follow my work on getting MathJax working in ASCIIsvg, here is a link to it on github:

https://github.com/leathrum/asciisvg-f

I do have some more recent tests that I will be posting there by the end of this weekend.

Peter Krautzberger

unread,
Feb 8, 2013, 11:44:41 AM2/8/13
to mathja...@googlegroups.com
Just to clarify: I'm only concerned with CAS compatibility here (not with integration into MathJax). I understand that there are significant syntax differences, but I also know that there are converters. 

IMHO, it seems important to offer users the ability to re-use the source in their CAS of choice, just like they can re-use formulas rendered by MathJax. Just my 2 cents.


Thomas Leathrum

unread,
Feb 8, 2013, 12:18:16 PM2/8/13
to mathja...@googlegroups.com
@Peter, you suggested "a proper MathJax extension", which is what got me thinking that you were looking to expand the MathJax library with graphing code -- if I misunderstood, I apologize.  For dealing with a CAS, it depends on what you want to paste into the CAS.  If you just want to copy and paste the image, SVG is probably the way to go -- I know Sage supports SVG, and I'm pretty sure Mathematica does, too, but I don't know about Maple, the new version very well might.  If you are looking to cut and paste the actually code from the JavaScript into a CAS and generate the same plot, which @r2d2 suggested in "Question #2", I'm afraid that is probably pretty hopeless at this point -- between 3 JavaScript libraries (XYJax, JSXGraph, and ASCIIsvg) and 3 CAS platforms (Mathematica, Maple, and Sage) you probably have at least 12 or 15 different ways of describing even a simple plot.  Yes, conversion is possible, but there is no standard, and I haven't seen any motion toward a standard other than SVG.  Like I said, I think the SVG output format is the most interesting part of this. 

Thomas Leathrum

unread,
Feb 13, 2013, 11:29:27 AM2/13/13
to mathja...@googlegroups.com
@r2d2 -- The ASCIIMathML SVG graphing code I have been working on, and which is at the github link I gave earlier, is getting pretty stable and complete, as far as currently seems possible.  It doesn't support the "\begin{graph}...\end{graph}" environment because that clashes with MathJax processing of anything that looks like "\begin{something}...\end{something}", but it does support both the "agraph...endagraph" and "(:graph...:)" environments that ASCIIMathML otherwise supports.  And it adds the "foreign()" method for including a <foreignObject> SVG tag with support for MathJax in its foreign content so that you can label graphs with MathJax-formatted labels.  The ASCIIMathML code for ASCIIMath and simplified LaTeX input in the HTML has been trimmed out in favor of MathJax.  Please check it out and see if it meets your needs for an ASCIIsvg graphing environment.  Here is the github link again, just in case:

https://github.com/leathrum/asciisvg-f/

r2d2

unread,
Mar 22, 2013, 4:18:12 PM3/22/13
to mathja...@googlegroups.com

Thanks so much for exploring the implementation of AsciiMathML graphing with MathJax. Is there any way to avoid the use of the Math Player for Internet Explorer? 

Peter Krautzberger

unread,
Mar 22, 2013, 4:23:35 PM3/22/13
to mathja...@googlegroups.com
MathJax does not depend on MathPlayer but will use it when present.


Dayal Purohit

unread,
Mar 22, 2013, 4:45:12 PM3/22/13
to mathja...@googlegroups.com
You have to have the default HTML-CSS renderer to work in IE. If that is not set, MathJax displays a big warning box saying it could not render because MathPlayer is not installed. I think instead of this warning, it should direct the user to change the renderer to HTML-CSS.

Davide P. Cervone

unread,
Mar 23, 2013, 9:12:10 AM3/23/13
to mathja...@googlegroups.com
This depends on your configuration.  If you have a configuration that specifies the NativeMML output render, then this is what you will see.  But all the pre-defined configurations on the CDN that select MathML will switch to HTML-CSS automatically if you don't have MathPlayer in IE.  So it seems that you may be using a custom configuration?  You might want to include the MMLorHTML configuration option.  See


for more details.

Note that IE < 9 wil not be able to render the SVG diagrams, so you should probably make some indication for IE users of IE8 and below.

Davide

Dayal Purohit

unread,
Mar 23, 2013, 10:46:14 AM3/23/13
to mathja...@googlegroups.com
Yes. Thanks. I think i had set the renderer asMathML in the browser for testing purposes and had not changed back to HTML-CSS. I cleaned up the cache and tried it, it works fine, renders in HTML-CSS.
Reply all
Reply to author
Forward
0 new messages