This is a “showcase blog” demonstrating that Wordpress and MathML can exist in harmony together. So far, all I’ve done is:
- Download and install wordpress
- Install the wordpress plugins ‘MarkdownItex’ and ‘XHTMLValidator’
- Activate these two plugins (taking care to not activate ‘Markdown Extra’ itself)
- Written this post.
And now, I can write mathematics! So let’s start with what is officially the most beautiful formula.
Of course, as expected, nothing works quite so simply. The first time that itex runs, assuming that it is not running locally, it needs to create a cache in which it can store all the mathml excerpts. So having written our post, we navigate to the correct directory, allow itex to create it’s cache, and then all is well:
cd wp-content/plugins/MarkdownItex
chmod 777 .
<reload homepage>
chmod 755 .
What we should have done at first was also modify our “theme” to display the correct “document type”. At the moment, we think that we’re just serving XHTML whereas we actually want to serve XHTML+MathML. So we need to install a “MathMLised theme”, or adapt a favourite one to MathML. This isn’t difficult, we just need to do two things: modify the DOCTYPE and serve the document as “application/xhtml+xml”. In mytheme/header.php, we change the DOCTYPE line to:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd" >
whilst in mytheme/functions.php we add the lines:
function reset_html_type($tf) {
return "application/xhtml+xml";
}
add_filter('pre_option_html_type', 'reset_html_type');
somewhere not in the middle of another function (there are other ways to achieve the same end as this).
Note: As we’re now serving proper XHTML, any little errors which previously were overlooked by forgiving browers will now be dealt with very strictly. So there may be other errors in the theme which only come to light upon further testing.
Further Note: As this is the first live test of the various themes and plugins, they aren’t publicly available yet. Anyone who wishes to test them is welcome to do so, just contact me for how to get hold of them.
How about comments?
Awesomeness. You rock!
breaking away:
Eyjafjallajökull from the most popular and trashiest newspaper in Germany.Hm, I posted the last comment and created the tex stuff by copy&paste from the Tex Wikipedia article, I mean it should have worked unless I pasted it wrong
Does the “Journal” theme work? That is my favorite.
Wikipedia does not use itex
@Tim: it’s itex, not tex. I guess I ought to add the “View Source” ability to the theme. I’m not sure what the error was in the first one, but the second should have used ‘aligned’ instead of ‘alignat’. Let me try:
If you could add a “Source” feature to this, you would super rock
Stick it down as “feature request”! Is there a “preview comment” plugin for wordpress?
>Is there a “preview comment” plugin for wordpress?
Not as far as I know…
Hmm, now why didn’t your comment get properly parsed?
should be a blockquote.
Andrew said:
uuhhh – that’s a difference I completly ignored to this point, without problems
admin says
I’d like to have that, too. Or an “edit after posting” one.
Not as far as I know…
And one that allows me to correct the typo in my own name.
>>Is there a “preview comment” plugin for wordpress?
>Not as far as I know…
That’s what I said! (Nested quotes?
)
Oh oh! A preview button!
Right, found a preview plugin. Let’s try it out with some maths as well: . Wow! It worked “out of the box” (well, with one modification but that was already in the readme and I don’t know that it wouldn’t have worked without that change).
This is really great! Now I just have to figure out how it works. Let’s try something like
Sweet!
By the way, how did Eric get the nice, big integrals? Mine was puny.
@Ian: Use double dollar signs
Eric asked about wikilinks. They ought to already be here. Let’s try with a link to the nlab itself: HomePage.
Oh, by the way. I think non-ascii wikilinks do not work.
Let me try it out:
so with a change of variables, .Hmm, some stuff came out in boldface… it’s because there was no space between the d and the x. If I put a space in, I get
and then the subsequent text is not boldface.Wait, it is! The looks fine but the following text is boldface. Huh.
I seem to have a knack for bumping into bugs! But anyway, this is great, Andrew. Congratulations! The world will thank you.
Firebug is fantastic. Using it, I was able to track down exactly why that’s in bold. It’s CSS, John, but not as we know it. I’ll fix it by-and-by.
Will this work if we use Wordpress.com as host? I’d really like it for my blog since I’ve received a few complaints about the way LaTeX is implemented on WP at the moment (makes it hard to real, I guess). If so, how do I get a copy of it? Thanks!
I have just installed another plug-in (wp-math-2) and it runs quite fine except for the same an issue already displayed above: the expression below a root is actually written below … well below as the root is written as a superscript before the expression, followed by a black rectangle and the expression below the rectangle. For example : Is there a way to fix this or overcome it? Is it due to a wrong LaTex syntax ?