I’m looking to start a blog with a lot of math content, and I’d like to know what is the best way to present equations typeset in LaTeX on the web. I assume I’m going to have to do it as image files, since there doesn’t seem to be any widely implemented math typesetting standard for browsers (MathML seems the closest, but isn’t supported by IE unless a plug-in is downloaded).
I really like Wikipedia’s system, where you can insert equations with snippets of LaTeX code that is then automatically rendered into images. But I don’t have my own host, and am likely going to be doing this on Blogger, or some other free blog service, so I doubt using a Wiki engine will be an option.
I also noticed there is a LaTeX2HTML package, though it looks like it hasn’t been updated since 2000 or so, and the examples of output in the documentation look kind of crummy.
Any other options out there? I’d rather not have to resort to manually cropping screenshots of LaTeX pdf’s.
I’m talking completely out of my ass, but this has piqued my curiosity since I’ve been spending some time screwing around with OpenOffice. Have you tried Open Office Math? It’s a mathematical expression typesetting app that at first glance seems pretty powerful. I just exported a Open Office Writer Doc as HTML with a mathematical expression in it that was created in OOMath. It opened it in Firefox, so there is a chance it may suit your needs.
I assume you know that OpenOffice is absolutely free, right? I apologize if this is nonsensical as I am completely unqualified in any aspect of web design, although I’m working on it.
I think you can assume that everyone who is interested already has a pdf reader, Adobe or otherwise. There is no harm in including a link to Adobe, however. You can use either pdflatex or latex followed by dvipdfm to put your output into pdf form.
If you already know latex, I would not consider learning an inferior system (I have not looked at Open Office math, but I am quite certain it is inferior) just for web posting, not when this superior alternative exists.
Good question. When you reach some solution, would you mind posting your choice with reasons why?
Knowing latex math usage, yeah, I can’t see using anything else; it’s just too beautiful. I seem to recall that, as you allude to, Wiki has some capability to directly parse/present latex formulas, but obviously that’s requires operating in their framework. Seeing as how I neither blog nor contribute to Wiki (or other such sites), I’m just not familiar with what’s out there. I wish I was on campus (I’m now a non-resident located halfway across the country); I seem to recall one of my office mates pointing something like this out.
At any rate, when such a need arose, I’ve always just produced an image file (e.g., eps, jpg, png, etc.) using the dvi conversions when I needed something like this. A quick google turned up l2p, which might do what you’d like.
ETA: from what I recall, the latex2html package isn’t really designed for math equations, but more for just getting a structured document into web presentable format (lists, headings, etc.), so I’d not spend too much time looking there.
Confession: Sometimes I type TeX code into my sandbox page on Wikipedia and then just steal the resulting images. Yeah, you can easily output images directly from TeX itself, but it’s just so simple to abuse the wiki.
If you’re comfortable with mucking around with CGI scripts on your server (and able to do so), you might look in to MathTex; it’s a server-side application that outputs .GIF files. (Of course, if you don’t have too many equations to typeset at a time, you could always just use the demo box about a quarter of the way down the page every time you need a new equation.)
I would do this, but I would like to present the math content mixed with HTML in a blog post, mainly so I can include hyperlinks and so people can comment on it. Keeping things out of pdfs has other advantages too, namely that the content will be immediately visible and the readers won’t have to download a new pdf every day to read my new entries.
This looks quite promising. I’ll have to check it out. Looks a little nicer than Wikipedia’s renders.
It seems like it could be useful someday, but I’m hesitant to use anything that requires the user to download fonts and plug-ins. Not that I imagine a lowly math blog will be getting tons of visitors, its just that most likely people will be accessing it from school computers and won’t have the permissions to install things.
MathML is balls. It’s far too verbose to be written natively, and the equation editors that support MathML output are a pain in the ass. Browsers don’t support it without plugins or addons.
As an added bonus, consider Wikipedia’s instructive example of TeX vs. MathML code for the same well-known equation:
Until there’s something less sucky than MathML that’s supported by all browsers natively, I think the best option is to do your equations in TeX and export them as images.
BTW, some blog software has plugins that can do this automatically , just like Wikipedia does. For example, here is how to do it in MovableType.
Check out webTeX. It’s a simple hack which lets you write a TeX expression in an attribute of a standard HTML image tag, and then you run the HTML page through a little Perl script which generates the images for you.
Simple, elegant and it works well. [disclaimer: the author is a friend of mine]
I checked out webTeX. I’ve been trying for the last few hours to get it to run in Windows, but the script uses a lot of shell commands via backticks, and the Windows shell can be pretty limited (doesn’t help I’m not that familiar with Perl). Maybe I ought to just set up a linux partition and dual-boot.
Before you do that, you might want to look into installing cygwin, which’ll supply all the yummy bash goodness you may desire. As an added bonus, you’ll be able to (easily and freely) set up sshd.
Disclaimer: I haven’t used cygwin for tex purposes, so I’m not sure it’ll actually help with webtex.
So, I spent the afternoon writing a python script for windows equivalent in functionality to webTex. I’m going to add a few features, like ability to change font-size and change LaTeX math environments (like math vs. displaymath), then I’ll put it up on the web somewhere for anyone here that’s interested.
friedo: MathML is a win if you have two independent programs communicating equations and both are linked to a debugged XML library as opposed to having buggy, ad-hoc code generators and parsers. (Ad-hoc generators and parsers are always buggy. Bug-free ones are a rounding error.) Given the proliferation of XML in general, and on the Web in specific, this is far from a strange assumption. Further, keep in mind that XML was never meant to be written or read by humans except in emergencies.
(The reason XML is good, to the extent it is, is that XML libraries can blindly apply certain rules to XML data without having to know what the data is supposed to mean. This allows you to catch blatant and obviously stupid errors early, and catching errors early is a Good Thing. The fact XML could have been a lot simpler and still done the same job is one more thing for geeks to rant about, but it isn’t entirely relevant at this late date.)