More on Blogging in LatexJanuary 28, 2010
Okay, so the irony of making a couple of posts about how great my blogging setup was, and then not writing anything else, is not lost on me. Before you completely write me off, I beg you, hear me out.
See, I was thinking about starting a series of posts on just some basic set theory. I figure, if this is going to be a place where I can describe some of my work, I better start at the beginning. Besides, even though set theory is pretty simple and cool and easy to explain, you can get into some interesting and deep ideas pretty quickly. I love the theory of ordinal numbers, for example, so I thought I would write about normal forms and the like
But the problem is, set theory is much easier to explain with pictures, so I needed to be able to draw pictures and post them along with the mathematics. And it occured to me, that in the spirit of automating my Latex posts, I ought to be able to extract any images I include and have them uploaded and linked in automatically. Unfortunately, the script latex2wp.py which I described before doesn’t really do anything like this.
And there were a couple other things I wanted: the script should automatically know the title of my post. (I did hack up a quick kludge to do this, but it wasn’t pretty.) And I should be able to make a new Latex macro to record my tags and categories.
In other words, I am a perfectionist. Even though I had things pretty well automated already, it was driving me crazy that there were a couple of loose ends, and I was compelled by my twisted brain to look into them.
My first conclusion was that the latex2wp.py script was nice, but that it was going to be difficult to make it really do all the things I wanted. The script was clearly meant to be called from the command line, to perform its basic transformations and quit. There was no support for parsing and understanding what your Latex file said, storing the information, and customizing a post based on the content. And when I thought about it, this is what I was really after.
Enter plasTeX. This was what I was really envisioning in my head all along. It parses your Latex document into a something like a custom DOM so that you can perform arbitrary transformations and rendering operations. Moreover, it’s extensible, object-oriented, Unicode aware, and written in Python. Combined with wordpresslib, which I mentioned before, this seemed like the best way of getting real integration between the Latex I was writing on my computer, and the posts that I sent out to the web.
So I’ve been working on this idea for the past couple of days, and finally came up with this. It basically does everything I wanted, and in the future could do even more, since it’s extremely easy to add new features. Automatically making use of WordPress’ source code feature comes to mind, along with more flexible rendering of arrays, aligns, and diagrams. You get the idea.
Unfortunately, there’s a bit more to getting this to work now than just running the script linked to above (you need a couple auxillary files and some paths to be set correctly) but I’ll try to tar up what you need and post some instructions in the next day or so.
I guess that’s all for now. I’m hungry.