logo4 Evolution is progress—                          
progress is creativity.        

Test Math Formula HTML

view blog view wiki view wiki view wiki

The first test were disappointing. It seems no mathematical formulas work with Creole.

Neither the mediawiki HTML format

{{math|{{radical|1 − ''e''²}}}}

Nor the TEX format

<math> f(x) = x^2\,\!</math>

Nor MathML

 <math xmlns="http://www.w3.org/1998/Math/MathML">
    <mo> &int; </mo>
    <mn> 0 </mn>
    <mn> 1 </mn>
    <msqrt><mi> x </mi></msqrt>
    <mo> &InvisibleTimes; </mo>
     <mo> &DifferentialD; </mo>
     <mi> x </mi>
Überschrift mit einer in MathML gesetzten Formel

Although I created a macro that is capable to display this, but it is not convenient to read.

0 1 x x

An other example.

<math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi mathvariant="double-struck">C</mi>

Is rendered as

17+29i C

And finally

<math xmlns="http://www.w3.org/1998/Math/MathML">



( 010 001 100 )

Examples from http://www.w3.org/Math/XSL/csmall2.xml

These two entries offer some useful suggestions.

  1. http://stackoverflow.com/questions/3219098/generating-equation-png-files-based-on-mathematical-input
  2. http://stackoverflow.com/questions/617668/looking-for-a-self-contained-equation-rendering-library

As I decided to implement matplotlib anyway, I opted for MathtextBackend. Unfortunately this is poorly documented. Although a tutorial and an extended example is available, no examples cover how it is used with web applications.

I learned from this webpage how to provide matplotlib graphics from a web server. An idea how to integrate matplotlib into django I found here.

This leaves us with two options how to implement matplotlib graphics

  1. by calling a view with the urlencoded TEX formula.
  2. by storing a temporary image that has to be destroyed after its use.

some formula

The implementation is explained here.

some plot

Tags: Software


(c) Mato Nagel, Weißwasser 2004-2013, Disclaimer