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 replaces LaTeXmathml v1.01. It introduces some new css so that LaTeX tables display in a more reasonable way and fixes a bug that caused numbered and unnumbered lists to be displayed incorrectly.

v1.01 fixed the bug that caused display equations and some other elements to display incorrectly.  For some reason, the "extend_view('css','LaTeXmathml/css');" command did not behave as expected and the problem was fixed by linking the CSS file directly in header.php.  I would like to use the native elgg framework way of doing things whenever possible, so if anyone knows why this didn't work then please let me know.  Anyway, here are the release notes:

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>


<link rel="stylesheet" type="text/css" href="<?php echo $vars['url']; ?>mod/LaTeXmathml/LaTeXMathML.standardarticle.css" />

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.

Note: 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 twe ak the TinyMCE setting to get it to behave properly if you want to.