Typesetting Question

Stephen Hawking’s publisher told him that, for every equation Hawking included, his readership would drop in half. I think it is fair to say that readers of the Secret Blogging Seminar are made of sterner stuff! However, including LaTeX objects in blog posts is a burden on the reader because (1) they are displayed as images and hence take longer to load (2) they can’t be cut and pasted, reducing the usefulness of the post and (3) on many browsers (particularly Safari) they can cause problems with text alignment. For this reason, I have tried to use fewer LaTeX objects writing here than I do when writing works meant to be read as PDF’s.

What I am wondering is whether or not to use LaTeX objects to display symbols that can be represented with ordinary characters. For example, which of the following is best?

We denote by \lfloor a \rfloor the greatest integer less than or equal to a.
We denote by \lfloor a \rfloor the greatest integer less than or equal to a.
We denote by \lfloor a \rfloor the greatest integer less than or equal to a.

(If you can’t tell, the “a” on the second line is italicized, using the HTML tag “<i>”.)

28 thoughts on “Typesetting Question

  1. For example, Safari does not correctly display Tao’s What’s New blog. Instead of accommodating Safari with work arounds, we should be complaining to Apple that the browser is not working correctly. I use the OmniWeb browser on my Mac and it does not seem to have any problems with this.

  2. The first one is best. Switching from the one-story math $\latex a$ to the other type looks weird. Personally, I don’t find the problems you list to be significant enough to take pains to avoid LaTeX. At least, that’s going to be how I handle my own research blog, once I get it up and running.

  3. I’d prefer the first of the three. In my browser, in the second and third versions, the variable name looks totally different in the floor than it does on its own: the one inside the floor has a large loop with a tail on the right, while the other one has a small loop with a bigger tail above it. Consistency of formatting is important because otherwise it might seem that you’re deliberately using two different types of a to mean two different things.

  4. Kinda sad that you have to even think about whether to type some math, let alone poll your readers about it.

    Despite the fact that I think using pictures of equations is evil (for the reasons you cite and for a bunch of others), there is one point on which you are too pessimistic.

    Copy/paste is no worse with pictures than it currently is with MathML.

    In Gecko-based browsers, highlight the text you want to copy, bring up the context menu (right-click), and choose “View Selection Source”. Copy that, and paste it at will

    We denote by the greatest integer less than or equal to .
    We denote by the greatest integer less than or equal to a.
    We denote by the greatest integer less than or equal to a.

    Let’s see how that worked, shall we?

  5. Not the third. The first is great — download time is minimal, especially for little pdfs — and I don’t mind the second, although the “a”s do look different.

    How about doing everything in MathML instead?

  6. Richard, I highly disagree. Safari is not rendering the page incorrectly. What it is doing is trying to render as much of the page as soon as possible, as opposed to other browsers which download the entire page first and then render the whole page.

  7. What you might consider doing is providing a pdf version of a post. Then those who have browser problems could just download the pdf.

    You can create a sed script that converts wordpress markup to LaTeX (replaces foo with $foo$, html i tag with \em{} etc.). As long as you do not use complicated formatting (tables, …) this is quite feasible.

  8. If Safari does not reflow the text when it discovers the image sizes, then that is a bug. If this is the only problem, wordpress could work around it by including the sizes of the images in the img tags.

    In my experience, Safari gives me a beach ball when rendering a wordpress page with a lot of math, and it takes a few seconds for the UI to be responsive again. I’d prefer if it took a little longer but remained somewhat responsive (assuming such a trade-off is even necessary).

  9. I have not had problems with WordPress math on Safari since switching to version 3 (3.0.3, I guess). Safari still doesn’t seem to get along with the WordPress live editor, though.

  10. It tries to reflow the text, but when you’ve got so many inline like that it sometimes loses track. Frankly, it’s never bothered me that much.

    On the other hand, I’ve never gotten the beach ball, so maybe something’s different on your system than mine.

  11. Everyone prefers the first, but the third gets the point across perfectly and is much faster to type and load. I vote for using it. And I have noticed that a lot of your pages take ages to load.

    Let’s put it this way. Which does the audience prefer? Fewer posts written the first way, or more posts written the third?

  12. I think that, once I get used to wordpress, the first will hardly take any longer to write. I am already used to using LaTeX enough that I will often enclose mathematical symbols in $’s in an e-mail without thinking about it. I haven’t gotten used to typing “$ latex” yet, but I assume that I will.

    I am surprised that no one cares about the time to load, though. I know that, when I am using a busy wireless conection and I look at one of the longer posts on this blog or Tao’s blog, there is often a noticeable lag time. This is made more annoying because I have to refresh to deal with the above mentioned Safari bug. Judging from the comments though, this doesn’t bother many people.

  13. I actually would vote for 2 or 3. The load time just isn’t worth it. I admit, I’m using Safari which is part of it. But I have found that with Safari if you just reload the page then the second time it usually displays everything correctly.

  14. The difference in font for the “a” in lines 2 and 3 is kind of jarring — if not for that, line 2 would fine. Of course in your example, you could actually do the whole thing just using HTML entities, and avoid the font mismatch:

    We denote by ⌊a⌋ the greatest integer less than or equal to a.

    (Hopefully the comment editor does the right thing with that.) Philosophically, I feel strongly that MathML is the right way to deal with this problem, although pragmatically it looks like using images rendered from LaTeX is the way people are going. I find it disheartening that the only way I can seem to get MathML and SVG images to display simultaneously is using IE with separate plug-ins for MathML and SVG, but the hopefully next generation of browsers will make this whole issue of historical interest only.

  15. David, I assure you you’ll get used to it. I just keep “$ latex” in my clipboard (Command-C) at all times, just to be ready to paste it over and over again without even thinking.

  16. what about plain Unicode:⎣a⎦?
    (I know, it looks less than beautiful, but it loads faster than images, that’s for sure…

  17. Kurt wrote:

    Philosophically, I feel strongly that MathML is the right way to deal with this problem, although pragmatically it looks like using images rendered from LaTeX is the way people are going.

    It’s just not feasible to use MathML in WordPress or, for that matter, in most hosted blogging services (Blogger, WordPress.com, Typepad, …).

    I find it disheartening that the only way I can seem to get MathML and SVG images to display simultaneously is using IE with separate plug-ins for MathML and SVG, but the hopefully next generation of browsers will make this whole issue of historical interest only.

    Browsers in the Mozilla family (Seamonkey, Firefox and Camino) support both natively.

  18. Jacques wrote:

    It’s just not feasible to use MathML in WordPress or, for that matter, in most hosted blogging services (Blogger, WordPress.com, Typepad, …).

    Is this because it’s too tedious to compose using the editors provided with those platforms? Or are the host servers not handling the MathML properly for some reason?

    Browsers in the Mozilla family (Seamonkey, Firefox and Camino) support both natively.

    I guess I’m a little bit out of date here. I could never get SVG to work to my satisfaction with Firefox 1.5, but I haven’t tried it out since switching to 2.0. I suppose this also raises the question of how to best serve one’s readers–especially for people who may be reading a blog from work and not have a choice of which browser or plug-ins to use. Every browser will support inline images, but the other stuff is still kind of hit-or-miss.

  19. Is this because it’s too tedious to compose using the editors provided with those platforms? Or are the host servers not handling the MathML properly for some reason?

    Composition is the “easy” part. You use a plugin that converts (a subset of) LaTeX to MathML. I even wrote one for WordPress.

    The hard part is that MathML and inline SVG must be embedded in an XHTML web page, which must be served as application/xhtml+xml (“real” XHTML), instead of text/html. Which means that your pages need to adhere to the strict well-formedness requirements of XML.

    It’s easy to get WordPress to spit out the desired content-type. Unfortunately, getting WordPress to reliably produce well-formed XHTML is pretty close to impossible. Most people who’ve tried have given up in frustration.

    MovableType is only a little better (but, clearly, possible). When SixApart releases their open-source version of MT (very soon, I hope), I’ll have to see about rolling a variant which, out of the box, does MathML.

    Looking beyond blogging software, I’m pretty pleased with the MathML/SVG support in Instiki.

    I guess I’m a little bit out of date here. I could never get SVG to work to my satisfaction with Firefox 1.5, but I haven’t tried it out since switching to 2.0.

    You are a bit out of date. Not only Firefox, but also Safari (3.0beta) and Opera have quite good native support for SVG.

    I suppose this also raises the question of how to best serve one’s readers–especially for people who may be reading a blog from work and not have a choice of which browser or plug-ins to use. Every browser will support inline images, but the other stuff is still kind of hit-or-miss.

    If you’re working in some setting where reading mathematical content on the Web might reasonably be considered a job-related activity, then demanding a browser upgrade (or plugin installation) would be perfectly justified.

  20. First off, I’m using MathML with some success in a wordpress installation – albeit NOT, should be said, in one by a hosting site somewhere.

    Furthermore, one of the ideas I have been bouncing around the DMV lately has been to setup a site specifically catered to mathematics bloggers – with MathML integrated from the get go, and with everything tuned and managed to keep mathematics writing as easy as possible. So far, I simply haven’t had time to put into the project, but on the noises I’ve heard, getting hardware to set something like this up wouldn’t be hard, and neither would getting a decent domain name to back it up, and automation for constructing new blogs.

  21. >First off, I’m using MathML with some success in a wordpress installation – albeit NOT, should be said, in one by a hosting site somewhere.

    Really? Cool!

    Is this on a publicly-accessible blog somewhere? (blog.mikael.johanssons.org, obviously, isn’t the one you’re talking about.)

    Have you released the WordPress patches/plugins required to pull it off.

    Furthermore, one of the ideas I have been bouncing around the DMV lately has been to setup a site specifically catered to mathematics bloggers – with MathML integrated from the get go, and with everything tuned and managed to keep mathematics writing as easy as possible.

    Well, at least as far as the software goes, that’s my plan for MTOS. The thing I’m still debating is whether to try to stay as close to a “stock” version of MT, adding only those things necessary to get MathML working, or to produce something with all the bells and whistles you’d find at my blog or at the n-Category Café.

  22. Perhaps illustrating the difference in how physicists and mathematicians treat details like typesetting and grammar, a QFT textbook I bought over the weekend includes the memorable phrase “without loosing generality.”

  23. Dmitry, can you elaborate on the sed script a bit more? I was thinking about writing a command line tool or a Java program that converts LaTeX documents to WordPress format, transforming \begin{equation} to $latex, \emph{} to and so on. But then things get complicated if you have used, for example \begin{split} or \begin{eqnarray} etc.

Comments are closed.