WeBWorK Main Forum

tikzjax

tikzjax

by Alex Jordan -
Number of replies: 0
I recently saw a demonstration from Jim Fowler of tikzjax:
http://tikzjax.com/

Jim found a way to get all of LaTeX plus tikz captured into 1MB of javascript. If that sounds hard to believe, there is a brief explanation at that link.

I wanted to post this here in case someone is interested (and has time, which I do not) to make use of this for a new WeBWorK graph-making tool. So that you could code graphics into a .pg problem using tikz code, and for the HTML the browser would just render it into SVG with no image file creation needed.

I know others, including Mike, have put work into using tikz commands within PG. Did those efforts look like this or have anything to do with tikzjax?

To use this for dynamic images like what you can do with PGgraphmacros, you'd have to come up with a way to interpolate Perl variables inside tikz code. Not sure how to do that well. One idea: since % is the LaTeX comment character, use that somehow, because it would never be a meaningful part of the tikz code (when unescaped). Like if the Perl $a was 5, then you could have something like

\draw (0,0) -- (%$a|,0);

and some initial phase of processing looks in between the %...| and turns that into:

\draw (0,0) -- (5,0);