Drupal - Latex and MathML Filters

in

drutex  filter module integrates latex and mathml.
Install prerequisites for this module:

 yum install tetex tetex-latex

I created special format with Latex filter enabled and called it "Scientific".
Then I followed technorati instructions and a good essay about formulas using MathML and LaTeXMathML.
Basically, we inject the mathml.js java script on pages with "scientific" format. This script is derived from the LaTeXMathML script.
Use the javascript injector module  for this.After installing and enabling the module and configuring user permissions, create the "MathML" injection rule.Set rule visibility based on PHP snippet, e.g. following these visibility recipes.Then created this PHP injection visibility rule:

 

  1.  
  2. <?php
  3. $math_format = 8;
  4. if (arg(0) == 'node' && is_numeric(arg(1))) {
  5.    $node = node_load(array('nid' => arg(1)));
  6.    if (isset($node) && $node->format == $math_format)  return TRUE;
  7. }
  8. return FALSE;
  9. ?>

 

FCKeditor by default substitutes special characters like & or < with HTML entities &amp; / &lt; breaking Latex filter. Therefore I created drutex module drutex_vitki_html_entities (commits 500, 501).

 

Internal conversion of MathML into Latex can be performed by MathParser. Also, there is a public web service from Wolfram research.

Attachments

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
To prevent automated spam submissions leave this field empty.