## Basic LaTeX Guide

Rules for posting and helping, along with guides for formatting and explanations of what to expect. Post "test" messages here.

### Basic LaTeX Guide

You can post formatted mathematical expressions by inserting LaTeX ("LAY-teck") commands between "tex" tags. You may click the "tex" button (at the right-hand end of the "formatting" row, across the top of the message-entry box) or else by typing the opening "$$" and closing "$$" tags manually.

Exponents and Subscripts: To format exponents, use the same carat symbol, " ^ ", as you always have on your graphing calculator, probably the Shift-6 key on your computer keyboard. Thus, "$$x^2$$" displays as "$x^2$". Note: If your exponent is more than just the one character, use the LaTeX grouping symbols of "curly braces". To raise something to the one-half power, you would format as "$$x^{1/2}$$" to get "$x^{1/2}$". You can insert subscripts by using the understroke character. For instance, "$$(x_1,y_1)$$" displays as "$(x_1,y_1)$". You can even combine the two: "$$x_1^2$$" displays "$x_1^2$".

Radicals: To create radical symbols, use the "sqrt" abbreviation (for "square root") and the back-slash "operator" command, using curly braces to indicate what goes inside the radical. To format the square root of seven, you would typeset as "$$\sqrt{7}$$" to get "$\sqrt{7}$". To create other radicals, such as cube roots, put the base (for cube roots, this would be "3") inside square brackets. To display the cube root of five, you would format as "$$\sqrt[3]{5}$$" to get "$\sqrt[3]{5}$".

Fractions: To create fractions, use the "frac" abbreviation and the back-slash operator, and use curly braces to group the numerator and denominator. To format two-thirds, you would type "$$\frac{2}{3}$$" to get "$\frac{2}{3}$". You can put expressions and other operators inside the numerator or denominator. For instance:

. . . . .$$\frac{\sqrt{2}}{3}$$ displays $\frac{\sqrt{2}}{3}$

If you want to surround your fraction in size-appropriate grouping symbols, use the "\left" and "\right" tags to indicate this. For instance:

. . . . .$$(\frac{14}{23})$$ displays as $(\frac{14}{23})$

...but:

. . . . .$$\left(\frac{14}{23}\right)$$ displays as $\left(\frac{14}{23}\right)$

Special Symbols: The "not equals" symbol "$\neq$" is inserted using "$$\neq$$". The "greater than or equal to" (the $\geq$ symbol) and the "less than or equal to" (the $\leq$ symbol) are inserted using "$$\geq$$" and "$$\leq$$", respectively. The "wiggly equals" for "approximately" is inserted using "$$\approx$$", which displays "$\approx$". The symbol "$\infty$", for "infinity", is inserted using "$$\infty$$". To insert a "plus-minus" sign, such as for the Quadratic Formula, use "$$\pm$$" to display "$\pm$". Many of these same symbols can be "cancelled" or negated by using the "\not" tag. For instance, "not less than or equal to" would be typeset as "$$\not\leq$$", which displays as "$\not\leq$".

Try not to use a lower-case "x" to indicate "times", since this will be confused with the variable. Instead, use the "\times" operator: "$$3 \times 5$$" displays as "$3 \times 5$". You can also use "\div" for the division symbol, "$\div$".

Colors and Spacing: Sometimes the default spacing is too crabbed and difficult to read. You can insert extra space by inserting "\," between your characters. For instance, "$$x^2+3$$" displays as "$x^2+3$", but "$$x^2\,+\,3$$" displays as "$x^2\,+\,3$". If you want to highlight something using color, use the "\color" operator and insert the desired color within curly braces. However, the different parts need to be inserted inside their own LaTeX tags, as the last color in the line seems to be interpreted (in the current installation) as being the color for the entire expression. For instance, "$$\color{red}x^2 \color{blue} \,+\,3$$" displays as "$\color{red}x^2 \color{blue} \,+\,3$", but "$$\color{blue}x^2\,$$$$\color{blue}+\,3$$" displays as "$\color{red}x^2\,$$\color{blue}+\,3$".

Greek Letters and Special Characters: To insert Greek letters, such as "$\pi$", spell the letter out, starting the name with a upper- or lower-case letter, depending on whether you want the upper- or lower-case Greek letter. So "$$\delta$$" is the lower-case "$\delta$" while "$$\Delta$$" is the upper-case "$\Delta$". Common angle names are "alpha", "beta", "gamma", and "theta", which display as $\alpha$, $\beta$, $\gamma$, and $\theta$, respectively. You can display the "angle" symbol $\angle$ by using "\angle".

You can insert summation symbols by using the capital "Sigma", and you can include lower and upper limits: "$$\Sigma_{i=1}^n 2^n$$" displays as:

. . . . .$\Sigma_{i=1}^n 2^n$

Integrals are formatted similarly: "$$\int_0^3 x^2 dx$$" displays as:

. . . . .$\int_0^3 x^2 dx$

You can display limits using the "\lim" and "\rightarrow" commands: "$$\lim_{x \rightarrow \infty} \frac{1}{x}$$" displays as $\lim_{x \rightarrow \infty} \frac{1}{x}$.

To display set and element notation, use "\subset" for $\subset$, "\not\subset" for $\not\subset$, "\subseteq" for $\subseteq$, "\in" for $\in$ ("is an element of"), "\cup" for $\cup$ (set union), and "\cap" for $\cap$ (set intersection).

Note that "\" and "{}" are LaTeX "reserved" characters. To display them, you must first "escape" them, so the LaTeX renderer knows that you're not using them to begin a command. For instance, to format a set, you would type "$$\{1,2,3\}$$" to display "$\{1,2,3\}$".

Function Names and Text: You'll quickly notice that all textual information is assumed by LaTeX to be variables. However, sometimes you actually want text, or at least non-italicised characters. One way to accomplish this is to insert the text inside the "\mbox{}" operator. For instance, "$$This is text.$$" displays as "$This is not text.$", while "$$\mbox{This is not text.}$$" displays as "$\mbox{This is not text.}$".

If you want function names, such as "sine" or "log", to be non-italicised, you can use the back-slash to tell the LaTeX renderer that "the following is the well-known function of (whatever)". For instance, "$$ln(x)$$" displays as "$ln(x)$", while "$$\ln{(x)}$$" displays as "$\ln{(x)}$". Other common function names are "\log", "\sin", "\cos", and "\tan". Each of these commands can take superscripts and subscripts: "$$\cos^2{(x)}$$" displays as "$\cos^2{(x)}$" and "$$\log_2{(x)}$$" displays as "$\log_2{(x)}$".

Links to further information will be posted eventually. For now, this site has a nice display of many characters and commends, and the Physics Forum has a nice tutorial post.

stapel_eliz

Posts: 1718
Joined: Mon Dec 08, 2008 4:22 pm

### Re: Basic LaTeX Guide

stapel_eliz wrote:
. . . . .$\Sigma_{i=1}^n 2^n$

I think the \sum command looks better

$\sum_{i=1}^n 2^n$

Code: Select all
\sum_{i=1}^n 2^n

Martingale

Posts: 350
Joined: Mon Mar 30, 2009 1:30 pm
Location: USA

### Re: Basic LaTeX Guide

I never knew how to do these before
$x^2 + 4x + 4 = (x + 2)^2$
michaelempeigne

Posts: 5
Joined: Wed Aug 05, 2009 1:20 pm

### Re: Basic LaTeX Guide

Just testing the LaTeX (no need to respond). $u = \phi \cdot \exp \left\{ {{\textstyle{1 \over 2}}\sigma \left( {x + y} \right)} \right\}$. And now a matrix:

$\left( {\begin{array}{c}
{{a_{11}}}&{{a_{12}}}\\
{{a_{21}}}&{{a_{22}}}
\end{array}} \right)$
afwings

Posts: 1
Joined: Mon Oct 04, 2010 8:42 pm

### Re: Basic LaTeX Guide

How do I write quantors like "for each" or "exists"?
Last edited by TeddyNall on Tue May 10, 2011 12:55 pm, edited 1 time in total.
TeddyNall

Posts: 1
Joined: Wed Apr 20, 2011 5:06 pm

### Re: Basic LaTeX Guide

TeddyNall wrote:How do I write quantors like "for each" or "exists"?

$\forall \exists$

\forall \exists

Martingale

Posts: 350
Joined: Mon Mar 30, 2009 1:30 pm
Location: USA