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. Brendon Brewer Avatar

    Apparently he’s relating the long-term time average of a pure-state expectation value in the limit trightarrow infty, with the instantaneous exp. value of a mixed state

    Hmm, that sounds like an ergodic theorem. I don’t like ergodic theorems because they pretty much have zero relevance except in algorithm design (MCMC and stuff).

  2. Carl Brannen Avatar

    The essence of the pure density operator formalism: States are operators instead of vectors. Example: $latex |arangle to rho_a = |arangle langle a|$. Example: $latex psi(x) to rho(x,x’) = psi^*(x’)psi(x)$

    Let $latex hat{S}$ be an operator that squares to 1. Then $latex (1pmhat{S})/2$ is (an opeartor and is also) an eigenstate of $latex hat{S}$ with eigenvalue $latex pm 1$. Example, spin 1/2 in the X direction has the operator:
    $latex hat{X} = left(begin{array}{cc}0&11&0end{array}right)$
    and therefore the density matrix state corresponding to it is:
    $latex rho_X = 0.5left(begin{array}{cc}1&11&1end{array}right)$

    If it passes this, that’s pretty good…

  3. Carl Brannen Avatar

    Hmm. ampersands sort of don’t work in the definition of arrays, they get an extra “amp;” .

  4. Aristotle Pagaltzis Avatar

    Regarding preview, may I recommend the AJAX Comment Preview plugin? It’s the best preview function I’ve seen anywhere, and easy to set up.

  5. Jason Avatar
    Jason

    Very nifty.

    $latex begin{displaymath}
    mathbf{A} =
    left( begin{array}{ccccc}
    1 & 0 & 0 & 0 &ddots
    d & -2d -a^2 & d & 0 & ddots
    0 & d & -2d -a^2 & d & ddots
    ddots & ddots & ddots & ddots & ddots
    hdots & 0 & 0 & 0 & 1
    end{array} right).
    end{displaymath}$

  6. Jason Avatar
    Jason

    Well, it worked in my term paper… ah, well.

  7. Christian Avatar
    Christian

    $latex lim_{3rightarrow4}sqrt{3}=2$

  8. tca Avatar

    You could simply use the Emacs Muse package for the “all in one” Emacs. It supports latex2png.

    Testing LaTeX in wordpress:

    [ tex]
    R=left(
    begin{matrix}
    2q_0^2-1+2q_1^2&2q_1q_2-2q_0q_3&2q_0q_2+2q_1q_3cr 2q_1q_2+2q_0q_3&2q_0^2-1+2q_2^2&2q_2q_3-2q_0q_1cr
    2q_1q_3-2q_0q_2&2q_0q_1+2q_2q_3&2q_0^2-1+2q_3^2
    end{matrix}
    right)

  9. tca Avatar

    Did not work… Sorry!

  10. […] 23, 2008 Ora aqui está qualquer coisa de muito importante que acabei de descobrir através do Cosmic Variance: como escrever equações neste blog, e apenas em WordPress, usando LaTeX… Fiquei […]

  11. Mark Avatar
    Mark

    A limerick:

    $latex int_1^sqrt{3} z^2,dz cross cos(frac{3pi}{9} = lnsqrt[3]{3}$

  12. Mark Avatar
    Mark

    2nd try:

    A limerick:

    $latex int_1^{sqrt{3}} z^2,dz cross cos(frac{3pi}{9}) = lnsqrt[3]{3}$

  13. Mark Avatar
    Mark

    And of course I get the formatting right but screw up the formula.

    $latex int_1^{sqrt[3]{3}} z^2,dz cos(frac{3pi}{9}) = lnsqrt[3]{e}$

  14. feg Avatar
    feg

    $latex e^{i*pi}+1=0$

  15. andy Avatar
    andy

    Hmm… not sure I know how this works, but…
    $latex T = left(dfrac{L_ast left(1-Aright)}{ 16pisigmaD^2 }right)^frac{1}{4}$

  16. andy Avatar
    andy

    Try again…
    $latex T = left(dfrac{L_ast left(1-Aright)}{ 16pi sigma D^2 }right)^frac{1}{4}$

  17. Joerg Avatar

    $latex partial_tvec{v}+[nablacdotvec{v}]=-frac{1}{rho}nablavec{p}-vec{g}-nabla² vec{v}²$

  18. Joerg Avatar

    Wow that wasn’t right
    $latex partial_tvec{v}+[nablacdotvec{v}]=-frac{1}{rho}nablavec{p}-vec{g}-nunabla^2 vec{v}^2$

  19. Count Iblis Avatar
    Count Iblis

    $latex displaystyleint_{0}^{infty}frac{x^{-p}}{1+x}dx=frac{pi}{sinleft(pi pright)}$

  20. Frank Oswalt Avatar
    Frank Oswalt

    $latex frac{Love – 0}{No Limit}$

  21. Erick Avatar
    Erick

    How can I use Latex on Windows? I’ve downloaded the Windows thing but when the interface comes up, there’s nothing to do. You know, to start a new document and start typing with those sciencey fonts..what am I missing?

  22. Navneeth Avatar
    Navneeth

    Let $latex epsilon

  23. Navneeth Avatar
    Navneeth

    $latex Let epsilon

  24. citrine Avatar
    citrine

    Formatting LaTEX commands seeems cumbersome to me. I’d think typing the Standard Model Lagrangian would be a nightmare! Embarrassing confession – I typed two dissertations using the Word equations editor. I’m waiting for the point and click version of LaTEX – essentially a more versatile version of Word E.E.

  25. efp Avatar
    efp

    Re #71 & #74:

    http://www.mackichan.com

    It’s commercial, but its &ltbad french accent&gt very nice &lt/bad french accent&gt

    If anyone knows of a open source/cross-platform equivalent, I’m all ears. But don’t tell my Lyx, it doesn’t come close.