JsMath and WP
Update: I realized that jsMath’s output doesn’t look too good in IE.
I’m writing a tiny plugin to load jsMath so I can use it in my posts. This should be a nice looking statement of the generalized integration by parts theorem:
vs.
Awesome! It finally works. I had to do a lot of digging in the WP code to implement this. First I found that the ‘wp_head’ hook isn’t sufficient, because jsMath must be loaded in the < body > , and wp_head loads in the < head > . Then, I looked and looked for an action hook that gets called at the top of the body whenever a page is rendered, but I couldn’t find one. Pretty strange that there doesn’t seem to be one. So, I spent a lot more time trying to track down how the plugin system works so I could add a hook myself. This may seem simple after the fact, but since I was looking for a more centralized architecture, it took me forever to figure out— I thought all the calls to do_action were registering hooks— but it turns out that the appropriate function will call do_action with the appropriate tag, to execute all the functions attached under that hook. Finally, I tracked down a sensible location for my additional hook: in the file template-functions-general.php as the last line in the function get_header, which returns the head of the file to be displayed, as well as the beginning of the body element.
The next thing to work on is making LaTeXRender use jsMath optionally— it’s a real pain to have to type in the start and end tags for a span or div everytime I want to use jsMath.
Possibly relevant posts:
- TeX support added to Commenting (1/23/2005)
- Code Highlighting Added (2/2/2005)
- Plugin idea: modifications to LatexRender (7/19/2007)
Wow, pretty cool! Can’t wait to play with it.
Comment by dider — 5/4/2005 @ 6:45 am
It looks good, but did you make the plugin of jsMath for WP? Then, would you upload it to let us to use it? Even though it is not implemented LaTeXRender if it is just optional, would you open your plugin for us? Thanks
Comment by Youngwhan — 5/1/2006 @ 9:02 am