Help:Editing Math Equations using TeX
36px | This article is part of the MathHelp Tutoring Wiki |
36px | 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
<math> syntax </math>
- For forced TeX rendering ( which produces an image )
<math> syntax ~</math> <math> syntex \,\!</math> <math> syntax \,</math>
| 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: <math>\frac{foo}{bar}</math>
Superscript and Subscript
To make superscripts and subscripts, use:
x^2 y_0
These render as: <math>x^2~y_0</math>
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: <math>\pi~\theta~\omega~\Omega~\gamma~\Gamma~\alpha~\beta</math>
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: <math>\cos(\theta)~\sin(\theta)~\tan(\theta)</math>, as opposed to:
cos(\theta) sin(\theta) tan(\theta)
Which look like: <math>cos(\theta)~sin(\theta)~tan(\theta)</math>
In general, if you want to make words not in italics in math, use
\text{foo bar}
Which looks like <math>\text{foo bar}</math> instead of <math>foo bar</math>
Big Brackets
Usually, a normal parenthesis or bracket will do fine:
x^2 (2x + y)
Renders as: <math>x^2 (2x + y)</math>
But if you have big stuff like fractions, it doesn't always look as nice:
(\frac{\pi}{2})
renders as: <math>(\frac{\pi}{2})</math>
Instead, use:
x^2 \left(2x + y\right) \left( \frac{\pi}{2} \right)
Which looks like: <math> x^2 \left(2x + y\right)~\left( \frac{\pi}{2} \right)</math>
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: <math> \left[ \frac{\pi}{2} \right]~\left[ x^2 (2x + y) \right]</math>
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}
<math>\sqrt{foo}</math>
\int_a^b f(x)dx
<math>\int_a^b f(x)dx</math>
\pm
<math>\pm</math>
\mp
<math>\mp</math>
\approx
<math>\approx</math>
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: <math>a_0 a_1</math> <math>a_0 a_1</math>
If you want to force spacing between symbols, you have to use the "~" symbol:
a_0~~~~~~~~~a_1
renders as: <math>a_012:43, 23 October 2013 (PDT)Wikiadmin (talk) 12:43, 23 October 2013 (PDT)a_1</math>
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)</math> A\cos(\omega t)~</math>
These will render as:
<math>A\cos(\omega t)</math> <math>A\cos(\omega t)~</math>
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: <math>v_2 = \sqrt{\frac{2\left(P_1 - P_2\right)}{\rho \left(1 - {\left(\frac{A_2}{A_1}\right)}^2\right)}}</math>