Succumbing to LaTeX

Written by

in

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.

Comments

200 responses to “Succumbing to LaTeX”

  1. chris Avatar
    chris

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

  2. chris Avatar
    chris

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

  3. chris Avatar
    chris

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

  4. chris Avatar
    chris

    $latex texbf{feel free to axe the above ones if things have become cluttered.}$

  5. chris Avatar
    chris

    $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} $

  6. chris Avatar
    chris

    That would have been a lot more impressive had it worked. 🙁

  7. chris Avatar
    chris

    $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) $

  8. chris Avatar
    chris

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

  9. Seth Avatar
    Seth

    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)$

  10. Seth Avatar
    Seth

    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?

  11. Neil B. Avatar

    It looks like everyone forgot or overlooked my question at #9, LMK if you have an answer, tx

  12. Brian Drell Avatar
    Brian Drell

    $latex E=frac{n^2pi^2hbar^2}{2mL^2}[tex]

  13. glenn Avatar
    glenn

    $latex R_{munu}-frac{1}{2}Rg_{munu}=8pi G T_{munu}$

    hehe. I’m plagiarizing!

  14. James Gallagher Avatar

    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
    🙂

  15. James Gallagher Avatar

    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
    🙂

  16. Count Iblis Avatar
    Count Iblis

    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]

  17. Count Iblis Avatar
    Count Iblis

    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$

  18. Count Iblis Avatar
    Count Iblis

    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)$

  19. Freiddie Avatar

    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?

  20. Freiddie Avatar

    $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$

  21. Freiddie Avatar

    Hey, it works! (I broke the entire formula into multiple pieces of [ tex ] and [ /tex ].

  22. C Avatar
    C

    $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}
    $

  23. C Avatar
    C

    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}

  24. Count Iblis Avatar
    Count Iblis

    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 🙂