Recognitions:
Gold Member
Staff Emeritus

## Introducing LaTeX Math Typesetting

Please go to this post for help with the current version of LaTeX used at Physics Forums.

Note: while the thread that follows has become outdated, many of the examples it contains are still relevant.

Physicsforums.com is proud to introduce the addition of LaTeX mathematical typesetting to our forum software!

LaTeX is a professional-grade general typesetting system that centers around very pleasing mathematical presentation. Mathematical expressions are written in a markup style somewhat similar to HTML.

You may include LaTeX graphics in any post here on physicsforums.com (but not in private messages).

To include a LaTeX graphic, simply include your LaTeX code within the tags [ tex ] [ / tex ] or [ itex ] [ / itex ] for inline. The real tags do not include spaces.

For example, the code
Code:
[ tex ] a^x_n [ /tex ]
produces the graphic $$a^x_n$$.

Note that you can click on any LaTeX image and see a popup containing the code for the image.

A pdf file of the most useful LaTeX commands, symbols, and constructs is provided here:

http://www.physicsforums.com/misc/howtolatex.pdf

More symbol reference:

http://www.cds.caltech.edu/~dunbar/docs/amsldoc.pdf

Below, I'm providing some example graphics demonstrating a variety of techniques. Click on each to view its source code.

$$\frac{1}{2}$$

$$R^a{}_{bcd}$$

$$\nabla \times C$$

$$\mathbb{RC}$$

$$\lambda_j = \vec{\lambda} \cdot \vec{e}_j$$

$$\lambda_j = \mathbf{\lambda} \cdot \mathbf{e}_j$$

$$v(t) = v_0 + \frac{1}{2} a t^2$$

$$\gamma \equiv \frac{1}{\sqrt{1 - v^2/c^2}}$$

$$\ddot{x} = \frac {d^2x} {dt^2}$$

$$\overline{x} \hat{x} \check{x} \tilde{x} \acute{x} \grave{x} \dot{x} \ddot{x} \breve{x} \bar{x} \vec{x} \underline{x}$$

\begin{align*} ab\\ a b\\ a\! b\\ a\, b\\ a\: b\\ a\; b\\ \end{align*}

$$\begin{multline*} a + b + c + d + e + f\\ +g+h+i+j+k+l+m+n \end{multline*}$$

$$\begin{gather*} a_1 = b_1 + c_1\\ a_2 = b_2 + c_2 - d_2 + e_2 \end{gather*}$$

$$e^x = \sum_{n=0}^\infty \frac{x^n}{n!} = \lim_{n\rightarrow\infty} (1+x/n)^n$$

$$\int_{0}^{1} x dx = \left[ \frac{1}{2}x^2 \right]_{0}^{1} = \frac{1}{2}$$

$$L = \int_a^b \left( g_{\it ij} \dot u^i \dot u^j \right)^{1/2} dt$$

$$\iiint f(x,y,z)\,dx\,dy\,dz$$

$$\lim_{\substack{x\rightarrow 0\\y\rightarrow 0}} f(x,y)$$

$$\idotsint_\textrm{paths} \exp{(iS(x,\dot{x})/\hbar)}\, \mathcal{D}x$$

$$A \alpha B \beta \Gamma \gamma \Delta \delta \dots \Phi \phi X \chi \Psi \psi \Omega \omega$$

$$\Gamma^l_{ki} = \frac{1}{2} g^{lj} (\partial_k g_{ij} + \partial_i g_{jk} - \partial_j g_{ki})$$

$$\sigma_{3} = \left( \begin{array}{cc} 1 & 0\\ 0 & -1 \end{array} \right)$$

\begin{align*} u &= \ln x \quad & dv &= x\,dx \\ du &= \mbox{\frac{1}{x}\,dx} & v &= \mbox{\frac{1}{2} x^2} \end{align*}

$$\newcommand{\pd}[3]{ \frac{ \partial^{#3}{#1} }{ \partial {#2}^{#3} } } i \hbar \pd{\Psi}{t}{} = - \frac{\hbar^2}{2 m} \ \pd{\Psi}{x}{2} + V \Psi$$


$$\begin{array}{l | c|c|c|c |} \ &\overline{A}\,\overline{B}&A\,\overline{B}&\overline{A}\, B&A\, B\\ \hline \overline{C}&0&1&0&0\\ \hline C&1&0&1&1\\ \hline \end{array}$$

$$\begin{equation*} \begin{split} \tau &= \tau_1+\tau_2 = \sqrt{{\Delta t_1}^2-{\Delta x_1}^2}+ \sqrt{{\Delta t_2}^2-{\Delta x_2}^2} \\ &= \sqrt{(5-0)^2-(4-0)^2}+\sqrt{(10-5)^2-(0-4)^2}\\ &= 3+3 = 6 \end{split} \end{equation*}$$

Whenever you want to include a graphic on the same line with your text, like $C H_4$ or $G_\textrm{diffeo}$ or $y = mx + b$, you should use [ itex ]...[ /itex ] instead of [ tex ]...[ /tex ]. The "i" means "inline."

Click on each of the examples above to "learn by example."

Good luck, and enjoy the system. Please test here: http://at.org/~cola/tex2img/index.php

- Warren
 PhysOrg.com science news on PhysOrg.com >> King Richard III found in 'untidy lozenge-shaped grave'>> Google Drive sports new view and scan enhancements>> Researcher admits mistakes in stem cell study
 Better: $$\Gamma^l_{ki} = \frac{1}{2} g^{lj} (\partial_k g_{ij} + \partial_i g_{jk} - \partial_j g_{ki})$$ Italicizing subscripts is unnecessary when those subscripts are variables and such; on the other hand, if they're words, you want to switch to text formatting instead of equation formatting. Examples of subscripting/superscripting: Good: $$x_i$$ $$G_{ij}$$ Bad: $$G_{diffeo}$$ Good: $$G_\textit{diffeo}$$ $$G_\textrm{diffeo}$$ Bad: $$R^a_{bcd}$$ Good: $$R^a{}_{bcd}$$ Okay: $$x_i^2$$ Maybe better: $${x_i}^2$$

## Introducing LaTeX Math Typesetting

$$\def\pds{\kern+0.1em /\kern-0.55em \partial} \def\lts#1{\kern+0.1em /\kern-0.65em #1} {\cal L}_R = \sum_{i=1}^G \bar{E}^i_R(i\pds - g_1Y_E \lts{B})E^i_R + \bar{D}^i_R(i\lts{D} - g_1Y_D \lts{B})D^i_R + \bar{U}^i_R(i\lts{D} - g_1Y_U \lts{B})U^i_R)$$

There's actually a whole 'slashed' package for this...
 Recognitions: Gold Member Science Advisor Staff Emeritus Feel free to propose a list of packages to be included here. I don't want to include tooooo many, for fear of slowing down image generation unnecessarily. On the other hand, I may eventually make the tag [ tex usepackage=apackage,anotherpackage ] [ /tex ] or similar. - Warren
 Recognitions: Science Advisor Lemme try. $$H_1 = - {\sin \phi - \sin \phi_{\rm s}\over \beta c} \, \sum_{j} e V_j \delta (\theta -\theta_j) \left(D\,{p_x\over p_0} - D'x \right)$$ Way cool. Say, can I use this (write a tex in physicsforums, preview it, save the resulting png, ...) to generate png's for my own web pages?

Recognitions:
Gold Member
Staff Emeritus
 Originally posted by krab Way cool. Say, can I use this (write a tex in physicsforums, preview it, save the resulting png, ...) to generate png's for my own web pages?
You can, but try not to bog the server down too much. If you'd like to see the source code for the conversion process so you can run it on your own machine, pm me.

- Warren

Blog Entries: 5
 Originally posted by krab Say, can I use this (write a tex in physicsforums, preview it, save the resulting png, ...) to generate png's for my own web pages? [/B]
I don't wish to burst your bubble krab, but please don't do this. The LaTeX generator was made for use strictly on PF. The resources needed to make these graphics can be relatively demanding.

 Originally posted by krab Way cool. Say, can I use this (write a tex in physicsforums, preview it, save the resulting png, ...) to generate png's for my own web pages?

http://latex2rtf.sourceforge.net/
http://www.fourmilab.ch/webtools/textogif/textogif.html

or make them online:

http://www.equationsheet.com/entertex.php

 Recognitions: Gold Member Science Advisor Brilliant! now excuse me while I just get a little practice $$e^+e^-\rightarrow u \bar{u}$$ $$e^+e^-\rightarrow \mu^+\mu^-$$ $$e^+e^-\rightarrow \gamma\gamma$$ $$i\hbar\frac{\partial\Psi}{\partial t} = \frac{\hbar^2}{2m}\frac{\partial^2\Psi}{\partial x^2} + V\Psi$$
 Recognitions: Gold Member Science Advisor Staff Emeritus Here's a question: I know how to write: $$\lim_{x\rightarrow 0} f(x)$$ But how do I get two levels of subscripting here? For instance, if I want to write $$\lim_{x\rightarrow 0,~y \rightarrow 0} f(x, y)$$ but have a two-line subscript instead of a long one-line subscript?
 $$\lim_{\substack{x\rightarrow 0\\y\rightarrow 0}} f(x,y)$$
 in fct it seems to complicate for me ..are there equation editors for latex?..i mean programs to write math simbols without knowing nothing of latex and a button to write integrals and limits
 Recognitions: Gold Member Science Advisor It's actually quite simple, I've never used it before, but reading through the tutorial it only took me a couple of minutes to work out how to write the simple equations above. Just try messing around with it to get a little practice. Quote the integral below to see the code for it: $$\int_{0}^{1} \frac{x}{\sqrt{a^2 + x^2}} dx = \left[ \sqrt{a^2 + x^2} \right]_{0}^{1}$$

Recognitions:
Gold Member