Log in


  • Category: Uncategorized
  • License: GNU General Public License (GPL) version 2
  • Updated: 2010-1-14
  • Downloads: 854
  • Recommendations: 0


LaTeXmathml plugin for Elgg 1.6

Last updated 1997 days ago

LaTeXmathml plugin

(Edit your project's description!)

Release Notes:

Update: There is a newer version of this plugin available.  Go to the Google Code site to get it.

This plugin is superceeded by LaTeXmathml v1.02.

This plugin allows users to enter LaTeX markup in any field which outputs according to the view 'output/longtext'.  At the moment this includes pages, messageboards and group forums.  LaTeX is also displayed in blog posts and messages, but this is done via a hack because these mods do not use the view 'output/longtext' for some reason.  Hopefully this will change in future versions of Elgg.

The plugin is based on the LaTeXMathML script by Jeff Knisley (http://math.etsu.edu/LaTeXMathML/).

For an example of this plugin in use, see my elgg site.

I will be maintaining a repository of elgg plugins that I have written at my website as well as here.

This plugin requires Elgg v1.1.

This plugin overrides the following views:

  • default/messages/messages
  • default/object/blog
  • default/output/longtext
  • default/page_elements/header

The plugin should be placed below the blog and messages modules in the loading order.

If you are using a modified theme that overwrites default/page_elements/header, then you will need to make some changes in order for the plugin to work:

  • Overwrite the views/default/page_elements/header.php in the LaTeXmathml plugin directory with views/default/page_elements/header.php from your theme.
  • Open the file in an editor and add "<script type="text/javascript" src="<?php echo $vars['url']; ?>mod/LaTeXmathml/javascript/LaTeXMathML.js"></script>" just before the </head> tag.
  • Add "<pre class="LaTeX"><div></div></pre>" just after the <body> tag.
  • Save the file.
  • Make sure LaTeXmathml is below your theme in the loading order.

This is an ugly hack, but I couldn't find a way to add code to the <head></head> and <body></body> sections of every page without completely overwriting the header.  Hopefully, this will be made possible in future versions of elgg.

Finally, a couple of known bugs:

  • Display equations are not centered and the equation numbers do not display in the same place.  This probably requires a hack to the LaTeXmathml.js or css.php file.  If anyone has any ideas then please let me know.
  • The plugin might not behave correctly with WYSWIG editors for textareas like TinyMCE because they add all sorts of whitespace characters and formatting that the LaTeXmathml parser might not like.  Personally, I prefer to use the mozex Firefox extension for editing textareas, but it should be possible to tweak the TinyMCE setting to get it to behave properly if you want to.