Succumbing to LaTeX

Update: The original post below was written as part of Cosmic Variance. Every time you move your blog, stuff like this changes. Here, the way to put something into Latex is to start with

$latex

and end with a simple

$

This stands in marked contrast with the previous system, explained below, although I think that system should still work.

——————————————————-

For a long time I was reluctant to joint the many other sciencey blogs that had integrated equations by providing support for LaTeX, the technical typesetting system that nearly every physicist and mathematician uses. Possible reasons for this attitude include:

  1. We felt it was important to remain accessible to a wide range of readership, and feared that the appearance of equations would put people off (and tempt us into being unnecessarily technical).
  2. It sounded like work.

You can decide for yourself which is more true. The good thing is, there is no wrong answer!

But right now I am uninspired to blog because my brain is preoccupied with real science stuff. So I thought of posting about some of the fun ideas in quantum mechanics I’ve been learning about. But there’s really no way to do it without equations. So for that reason, and in belated honor of Donald Knuth’s birthday, I went and installed the LatexRenderer plugin.

So now it’s easy to include equations; they should even be available in comments. All you have to do is type [ latex ], then your LaTeX commands, then [ /latex ], except no spaces. So for example

[ latex ]R_{\mu\nu}-\frac{1}{2}Rg_{\mu\nu}=8\pi G T_{\mu\nu}[ /latex ],

if you left out the spaces, should produce

R_{\mu\nu}-\frac{1}{2}Rg_{\mu\nu}=8\pi G T_{\mu\nu}.

There are a million online tutorials; try this list of commands to get you started. Use comments to this post to try it out. (Sadly, no preview, so be careful, and this post will remain open for playing around.) One thing I’ve noticed: don’t use linebreaks within the formulas, just put everything on the same line. And use “displaystyle” if you want the look of a set-off (rather than in-line) equation.

This entry was posted in Blog. Bookmark the permalink.

200 Responses to Succumbing to LaTeX

  1. Sam says:

    [ tex] e_ipi=-1 [ /tex]

  2. Big Vlad says:

    $latex e^{PI i} = -1 [tex]

  3. Sean says:

    Shouldn’t have any spaces between the “[” and the “tex” or “tex”.

  4. Sean says:

    And it’s pi, not PI.

  5. Julianne says:

    This has to be the most fabulously geeky comment thread, EVAH!

  6. Neil B. says:

    Hi, I am still looking for good (and hopefully free) program to convert Word or maybe WPerfect to LaTex. The one I downloaded (Word2tex) seems unable to perform, likely because I just don’t get how to use all those wacky little files. I mean, I just want to rev up a simple click-to-start program (like any other Windows product) to take the Word doc and turn it into a LaTex document (and look at it to be sure it is right) without hassle, any help please? tx

  7. Sean says:

    Julianne, don’t you mean epsilonnualphahbar?

  8. Bob Munck says:

    LaTeX. That’s so 20th century. The modern, up-to-date way to support equations is MathML; it’s what all the kids are using these days.

    To be honest, we tried for weeks to get MathML to work on one of the Space Elevator forums, and never succeeded. Your LaTeX renderer is somewhat of a kludge, but one can’t argue with the fact that it works.

    Did you know that one of the programming languages used by NASA for the Space Shuttle software, HAL/S, supported multiple-line statements containing 2-D equations?

  9. Not sure if it’s important, but it doesn’t seem to work in the feed. Reading the feed in bloglines, I just got the markup, not the equation.

  10. Sam Gralla says:

    Oh yeah, first try. I’m a winner.

  11. Sean says:

    Christina, really? It shows up okay for me, both in bloglines and in Google reader. Which feed are you using? Do you usually see images? (Because that’s all they are.) Do you have some weird background color?

  12. tacitus says:

    Kind of beautiful, in an austere way, don’t you think?

    …and utter gobbledygook to physics and maths illiterates like me 🙂

    Have fun.

  13. Eugene says:

    I see your density matrices and raise you a unitary operator, stuff that I am thinking about

    $latex ifrac{partial}{partial t} U(t,t’) = H_I(t)U(t,t’)[tex]

  14. Freiddie says:

    $latex epsilon_123=1[tex]
    Does it work?
    Does the first equation with the R_mu_nu in your blog post have anything to do with general relativity?
    And I haven’t got a clue what those “austerely beautiful” equations are, or mean.

  15. Freiddie says:

    $latex epsilon_{123}=1[tex] Trying again

  16. Jerry Boetje says:

    Bob, I remember HAL from about an eon ago. Developed at Draper Labs in Cambridge and named for the gentleman who developed much of the Apollo navigation code. You could write a Kalman filter in 2 lines of code using the sub/superscript capability. Very cool. Thanks for reminding me of those days.

  17. Sean says:

    Forward slashes on the closing /tex, guys.

    Precision counts!

    epsilon_{123}=1

    And yes, the first example is Einstein’s equation of general relativity.

  18. Helge says:

    $latex detbegin{pmatrix} 0 & 1 1 & 0 end{pmatrix} = -1 {tex]
    sucks.

  19. Helge says:

    $latex detbegin{pmatrix} 0 & 1 1 & 0 end{pmatrix} = -1 [tex]
    sucks.

  20. Jim says:

    Sean, this is fabulous! I’ve been looking for a host that has $latex LaTeX[tex] installed. InMotion may be exactly what I’ve been looking for and may prompt a server switch in the very near future.

  21. Jim says:

    Huh, I think I got the ending tag wrong (it’s counterintuitive). It should have been LaTeX.