# Help:Editing Math Equations using TeX

Jump to: navigation, search
 This article is part of the MathHelp Tutoring Wiki
 This article is part of the PhysicsHelp Tutoring Wiki

This is how you edit math equations using the TeX syntax to make nice looking equations. Please use TeX when writing math. Trying to put equations directly into the text doesn't look very nice and TeX is very easy to learn.

If you already use TeX, then all you need to know is that your normal syntax must be surrounded by tags:

• For HTML rendering if possible
$syntax$

• For forced TeX rendering ( which produces an image )
$syntax ~$
$\displaystyle syntax$
$syntax \,\!$
$syntax \,$


The above forced rendering are explained in Forced PNG rendering

If you've never used TeX before, here's a crash course:

## Contents

### Fractions

To make a fraction use:

\frac{foo}{bar}


These render as: ${\displaystyle {\frac {foo}{bar}}}$

### Superscript and Subscript

To make superscripts and subscripts, use:

x^2
y_0


These render as: ${\displaystyle x^{2}~y_{0}}$

### Greek Letters

To make greek letters, you just need to know their names. Use a capital for the capital letter, a lower-case for the lower-case letter:

\pi
\theta
\omega
\Omega
\gamma
\Gamma
\alpha
\beta


These render as like: ${\displaystyle \pi ~\theta ~\omega ~\Omega ~\gamma ~\Gamma ~\alpha ~\beta }$

### Trig Stuff

You can use the following to render trig functions without italics so it looks nicer:

\cos(\theta)
\sin(\theta)
\tan(\theta)


These render as: ${\displaystyle \cos(\theta )~\sin(\theta )~\tan(\theta )}$, as opposed to:

cos(\theta)
sin(\theta)
tan(\theta)


Which look like: ${\displaystyle cos(\theta )~sin(\theta )~tan(\theta )}$

In general, if you want to make words not in italics in math, use

\text{foo bar}


Which looks like ${\displaystyle {\text{foo bar}}}$ instead of ${\displaystyle foobar}$

### Big Brackets

Usually, a normal parenthesis or bracket will do fine:

x^2 (2x + y)


Renders as: ${\displaystyle x^{2}(2x+y)}$

But if you have big stuff like fractions, it doesn't always look as nice:

(\frac{\pi}{2})


renders as: ${\displaystyle ({\frac {\pi }{2}})}$

Instead, use:

x^2 \left(2x + y\right)
\left( \frac{\pi}{2} \right)


Which looks like: ${\displaystyle x^{2}\left(2x+y\right)~\left({\frac {\pi }{2}}\right)}$

Notice that these kinds of brackets are always the right size. They also work with square brackets:

\left[ \frac{\pi}{2} \right]
\left[ x^2 (2x + y) \right]


Renders as: ${\displaystyle \left[{\frac {\pi }{2}}\right]~\left[x^{2}(2x+y)\right]}$

### Other

These are some other things that may be useful. In general, if you want to know how to make a type of symbol, you can find many usefuly lists by searching for TeX or LaTeX math symbols.

\sqrt{foo}


${\displaystyle {\sqrt {foo}}}$

\int_a^b f(x)dx


${\displaystyle \int _{a}^{b}f(x)dx}$

\pm


${\displaystyle \pm }$

\mp


${\displaystyle \mp }$

\approx


${\displaystyle \approx }$

One thing you may notice is that adding spaces between symbols will not add more space in the rendered output.

a_0         a_1
a_0 a_1


These will both render as: ${\displaystyle a_{0}a_{1}}$ ${\displaystyle a_{0}a_{1}}$

If you want to force spacing between symbols, you have to use the "~" symbol:

a_0~~~~~~~~~a_1


renders as: ${\displaystyle a_{0}~~~~~~~~~a_{1}}$

Also, it can be useful to note that there as two kinds of math font that the wiki will try to use. One is a smaller font which fits better into a line of normal text, and the other is a larger font which looks nicer when you have an equation on its own line. Whenever you make somthing "big" like a fraction or square root symbol, the wiki will automatically use bigger font. Sometimes you may want to force a line to be bigger because it looks nicer. I have found no nice way to do this other than it just so happens that if you put a "~" at the end of a line that line will be rendered in the bigger font; since the "~" is at the end you won't notice that there is technically an extra blank space there.

A\cos(\omega t)[/itex]
A\cos(\omega t)~[/itex]


These will render as:

${\displaystyle A\cos(\omega t)}$ ${\displaystyle A\cos(\omega t)~}$

Lastly, don't be afraid to nest things together to make really complicated looking expressions:

v_2 = \sqrt{\frac{2\left(P_1 - P_2\right)}{\rho \left(1 - {\left(\frac{A_2}{A_1}\right)}^2\right)}}


will render as: ${\displaystyle v_{2}={\sqrt {\frac {2\left(P_{1}-P_{2}\right)}{\rho \left(1-{\left({\frac {A_{2}}{A_{1}}}\right)}^{2}\right)}}}}$