Writing Mathematics in WordPress

It would be nice to be able to use mathematics in WordPress to write equations as easily as I can write this sentence, but I can’t. What are the options for someone writing a technical blog?
LaTeX Plugin
LaTeX is a popular choice in the scientific community. It uses a code to typeset equations. The final document is a postscript or pdf document to produce a well typeset beautiful looking documents. For the web, LaTeX equations can be converted to .gif images. WordPress also has a plugin which uses LaTeX to render the code as gif images within your post. You might think, great problem solved but in order to use the plugin you must be able to install LaTeX on your server and this is an option which is not available to many people on managed hosts.
So, if LaTeX is out of the question, what are your options? Let’s have look.
MathML
It has been long awaited that browsers should adopt MathML which would allows mathematical equations to be rendered using a set of tags in the code in a similar way to HTML. However, there has not been a rush to implement this standard and as a result many browsers are unable to display MathML correctly or do not display it at all. While this state of afairs continues, MathML will not be adopted by the scientific community. We await progress in this area.
Equations as Images
You can use other equation editing programs to produce equations and save them as image. This can produce some good looking results but if you have a lot of equations, adding them to WordPress can be tedious and if you need to edit them it may want to stop you adding equations to your posts.
You could use text to create mathematics and this seems to be the option used by most people as long as the equations don’t involve fractions and other difficult to replicate features of equations. You can write equations using just html but the results are awkward and difficult to read for all but the simplest mathematics.
CSS for Writing Equations
As I cannot have LaTeX on my blog. I have gone down the route of using Cascading Style Sheets (CSS) to display equations. The results are pretty good considering that it was never designed for this purpose. It works by altering the individual size, position, margins and padding around different text elements.
Most browsers support the use of HTML entity codes for mathematical symbols. A particularly difficult character to find is ħ which is used extensively in quantum physics. It has the code
ħ Other useful codes for mathematical and other symbols can be found from the link. The code for the CSS is give below:
#eqn {
border: none;
margin: 0;
font-size: 1em;
}
.eqnnum {
float: right;
font-weight: bold;
}
.overline {
text-decoration: overline;
}
.unit-vector {
font-weight: bold;
}
.hat {
font-weight: bold;
font-size: 0px;
line-height: 0px;
display: none;
visibility: hidden;
}
sub {
vertical-align: middle
}
.big {
font-size: 2.2em;
font-family: ‘Times New Roman’, Serif; vertical-align: -0.25em;
margin-right: 6px;
padding-top 5px;
}
.bigbracket {
font-size: 2.0em;
vertical-align: -0.1em;
padding: 0;
font-family: ‘Times New Roman’, Serif; margin: 0;padding-right: 8px;
}
.normal {
vertical-align: middle;
}
.upperbound {
margin:0;
padding:0;
margin-left: -0.4em;
vertical-align: 1.1em;
font-size: 0.7em;
}
.upperbound2 {
margin:0;
padding:0;
margin-left: -1.6em;
vertical-align: 1.1em;
font-size: 0.7em;
}
.lowerbound {
margin:0;
padding:0;
margin-left: -0.9em;
vertical-align: -0.8em;
font-size: 0.7em;
}
.uppersum {
margin: 0;
padding:0;
margin-left: -1.8em;
vertical-align: 1.3em;
font-size: 0.7em;
}
.lowersum {
margin: 0;
padding:0;
margin-left: -1.6em;
vertical-align: -1.4em;
font-size: 0.7em;
}
.fraction {
text-align: right;
}
.numerator {
vertical-align: 0.7em;
border-bottom: solid 1px #333;
}
.denominator {
vertical-align: -0.7em;
margin-left: -1.4em;
}
.underlim {
margin: 0;
padding: 0;
margin-left: -3.5em;
vertical-align: -1.0em;
font-size: 0.7em;
}
.newtonsD {
margin:0;
padding: 0;
margin-left: -1em;
vertical-align: 0.8em;
margin-right: 0.4em;
}
.over {
margin: 0;
vertical-align: 0.9em;
margin-left: -0.8em;
font-size: 0.7em;
}
To create equations use the span tag with the desired class. For example to create the equation:
<sup class=“uppersum”>∞</sup>
<sub class=“lowersum”>k=0</sub>
<i>f</i>(<i>x</i><sub class=“normal”>k</sub>)Δ<i>x</i> =
<span class=“big”>∫</span>
<sup class=“upperbound”><i>b</i></sup><sub class=“lowerbound”><i>a</i></sub>
<i>f</i>(<i>x</i>) <i>dx</i>
Differentials:
<span class=“denominator”><i>dx</i></span>
(<i>U</i>/<i>V</i>) = [<i>U</i>
<span class="numerator"><i>dV</i></span>
<span class="denominator"><i>dx</i></span> - <i>V</i>
<span class="numerator"><i>dU</i></span>
<span class="denominator"><i>dx</i></span> ]/ <i>V</i><sup>2</sup>
You may find that you need to alter some of the values depending on the font-size. This method has difficulty handling long fractions and also matrices but for most purposes it can be adopted as compromise until something better comes along.
Latex Gloves available here
great new Pop up Display here
solid oak flooring sold here
check out our new Display stands
Tags: CSS, equations, mathematics, wordpress


![Validate my RSS feed [Valid RSS]](http://www.seothegame.com/wp-content/uploads/2008/11/valid-rss.png)
[...] Following on from my original article on publishing equations on the web, there is a new method which may be useful to those information retreival specialists or publishers [...]
This is an awesome post!!!
Thanks CJ