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 your comment with the tag

{latexpage}

Except — important! — use square brackets [] rather than curly braces {}. Then anything you put inside dollar signs gets interpreted as a LaTeX math formula, as usual. So

$g_{\mu\nu}$

should show up as

g_{\mu\nu}.

I’m using the QuickLaTeX plugin; more details here.

This stands in marked contrast with the previous system, explained below.

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

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.

200 Comments

200 thoughts on “Succumbing to LaTeX”

  1. $latex left(begin{tabular}{ll} 1 left( begin{tabular}{ll}1 2 1 2 end{tabular}right) 1 2end{tabular}right)$

  2. $latex textbf{sigma}=right{ left( begin{tabular}{ll}0 1// 1 0end{tabular}right) ,left( begin{tabular}{ll}0 -i// i 0end{tabular}right) , left( begin{tabular}{ll}1 0// -1 0end{tabular}right) right} $

  3. $latex textbf{sigma}=right( left( begin{tabular}{ll}0 1 1 0end{tabular}right) ,left( begin{tabular}{ll}0 -i i 0end{tabular}right) , left( begin{tabular}{ll}1 0 -1 0end{tabular}right) right) $

  4. Okay, so much for that. Sorry about the big white splotches, you might want to get rid of them. Congrats on getting the latex!

  5. Can’t resist..

    $latex sigma(p(P)p(P) to Y + X) = int_0^1dx_1int_0^1dx_2f_1(x_1)f_2(x_2)sigma(q_1(x_1P)q_2(x_2P) to Y)$

  6. Err… that was:

    sigma(p(P)p(P) to Y + X) = int_0^1dx_1int_0^1dx_2f_1(x_1)f_2(x_2)sigma(q_1(x_1P)q_2(x_2P) to Y)

    What’s wrong?

  7. I’ll try your formula Seth:

    $latex sigma(p(P)p(P) to Y + X) = int_0^1dx_1int_0^1dx_2f_1(x_1)f_2(x_2)sigma(q_1(x_1P)q_2(x_2P) to Y$latex

    “Potentially dangerous”, wow, these days you just don’t know where you are safe.

    Chris, I like your recent contributions, ala G Lissi, you’ve created a Theory of Nothing
    🙂

  8. I’ll try your formula Seth:

    $latex sigma(p(P)p(P) to Y + X) = int_0^1dx_1int_0^1dx_2f_1(x_1)f_2(x_2)sigma(q_1(x_1P)q_2(x_2P) to Y$

    “Potentially dangerous”, wow, these days you just don’t know where you are safe.

    Chris, I like your recent contributions, ala G Lissi, you’ve created a Theory of Nothing
    🙂

  9. Let’s give Seth’s formula another try:

    $latex sigma(p(P)p(P) rightarrow Y + X) = int_0^1dx_1int_0^1dx_2f_1(x_1)f_2(x_2)sigma(q_1(x_1P)q_2(x_2P) rightarrow Y[tex]

  10. OOps, made a trivial error, let’s try again:

    $latex sigma(p(P)p(P) rightarrow Y + X) = int_0^1dx_1int_0^1dx_2f_1(x_1)f_2(x_2)sigma(q_1(x_1P)q_2(x_2P) rightarrow Y$

  11. The software they use at Physicsforums does not complain, so perhaps here we need to care about the delimeters being closed properly… let’s try again:

    $latex sigma(p(P)p(P) to Y + X) = int_0^1dx_1int_0^1dx_2f_1(x_1)f_2(x_2)sigma(q_1(x_1P)q_2(x_2P) to Y)$

  12. I tried parsing the formula in Wikipedia – works fine,
    but I’m not sure it’ll work here.
    This is what you have been trying, right?
    sigma(p(P)p(P) rightarrow Y + X) = int_0^1dx_1int_0^1dx_2f_1(x_1)f_2(x_2)sigma(q_1(x_1P)q_2(x_2P) rightarrow Y
    Now, here’s the formula (may not work…):
    $latex sigma(p(P)p(P) rightarrow Y + X) = int_0^1dx_1int_0^1dx_2f_1(x_1)f_2(x_2)sigma(q_1(x_1P)q_2(x_2P) rightarrow Y$
    Does it work?

  13. $latex sigma(p(P)p(P) rightarrow Y + X)$$latex = int_0^1dx_1$$latex int_0^1dx_2f_1(x_1)f_2(x_2)$$latex sigma(q_1(x_1P)q_2(x_2P)$$latex rightarrow Y$

  14. $latex psset{unit=0.5cm}
    begin{pspicture}(-4,-0.5)(4,8)
    psgrid[subgriddiv=0,griddots=5,gridlabels=7pt](-4,-0.5)(4,8)
    psline[linewidth=1pt]{->}(-4,0)(+4,0)
    psline[linewidth=1pt]{->}(0,-0.5)(0,8)
    psplot[plotstyle=curve,linewidth=0.5pt]{-4}{0.9}{10 x exp}% postscript function
    rput[l](1,7.5){$10^x$}
    psplot[plotstyle=curve,linecolor=red,linewidth=0.5pt]{-4}{3}{2 x exp}% postscript function
    rput[l](2.2,7.5){color{blue}$e^x$}
    psplot[plotstyle=curve,linecolor=blue,linewidth=0.5pt]{-4}{2.05}{2.7183 x exp}% postscript function
    rput[l](3.2,7.5){color{red}$2^x$}
    rput(4,8.5){color{white}changenormalcolor}
    rput(-4,-1){color{white}bounding boxnormalcolor}
    end{pspicture}
    $

  15. Not quite working properly…maybe some packages need to be installed? For example, see http://sixthform.info/steve/wordpress/?p=24. Also, it would be nice to have the javascript option, where clicking on the equation brings up the latex code that generated it.

    psset{unit=0.5cm}
    begin{pspicture}(-4,-0.5)(4,8)
    psgrid[subgriddiv=0,griddots=5,gridlabels=7pt](-4,-0.5)(4,8)
    psline[linewidth=1pt]{->}(-4,0)(+4,0)
    psline[linewidth=1pt]{->}(0,-0.5)(0,8)
    psplot[plotstyle=curve,linewidth=0.5pt]{-4}{0.9}{10 x exp}% postscript function
    rput[l](1,7.5){$10^x$}
    psplot[plotstyle=curve,linecolor=red,linewidth=0.5pt]{-4}{3}{2 x exp}% postscript function
    rput[l](2.2,7.5){color{blue}$e^x$}
    psplot[plotstyle=curve,linecolor=blue,linewidth=0.5pt]{-4}{2.05}{2.7183 x exp}% postscript function
    rput[l](3.2,7.5){color{red}$2^x$}
    rput(4,8.5){color{white}changenormalcolor}
    rput(-4,-1){color{white}bounding boxnormalcolor}
    end{pspicture}

  16. C, isn’t there anything to render postscript directly? Then we could all just compile the latex code (including possible eps figures) to postscript and copy and paste that on this blog 🙂

Comments are closed.

Scroll to Top