A previous thread covered this topic (found here) but I figured a more detailed explanation could be given to help some people out.

The forum has both math and tex tags. However, the tex tags seem broken and don't properly render a lot

of stuff so we *highly* suggest using math tags instead of trying to get tex tags to work.

The forum includes typesetting using LaTex through the use of two special tags:

and
.

A quick example - The following code:

produces the following result: \(Y_i = \mu_i + \epsilon_i\)

There are various ways to see the code somebody else used to produce their mathematical typesetting. If you have javascript enabled you can click on their typesetting and a popup will display the code they used. If that doesn't work you can always 'quote' the post of interest and examine their post directly to see how they formatted it.

2) Symbols

There are many symbols that can be produced through the use of LaTeX. There are many guides on the internet that will show you the thousands of symbols that can be created. However, for a quick guide you can refer here or just browse other member's posts. It's not that bad and you can learn quickly. For a quick list of the more commonly used symbols you can refer below:

\(

\begin{array}{|l|c|}

\hline

Code & Result \\

\hline

alpha & $\alpha$ \\

beta & $\beta$ \\

epsilon & $\epsilon$ \\

lambda & $\lambda$ \\

mu & $\mu$ \\

sigma & $\sigma$ \\

theta & $\theta$ \\

chi & $\chi$ \\

\hline

\end{array}

\)

\(

\begin{array}{|l|c|}

\hline

Code & Result \\

\hline

cap & $\cap$ \\

cup & $\cup$ \\

cdot & $\cdot$ \\

cdots & $\cdots$ \\

ldots & $\ldots$ \\

\hline

\end{array}

\)

\(

\begin{array}{|l|c|}

\hline

Code & Result \\

\hline

leq & $\leq$ \\

geq & $\geq$ \\

neq & $\neq$ \\

subset & $\subset$ \\

sim & $\sim$ \\

equiv & $\equiv$ \\

propto & $\propto$ \\

\hline

\end{array}

\)

\(

\begin{array}{|l|c|}

\hline

Code & Results \\

\hline

exists & $\exists$ \\

forall & $\forall$ \\

infty & $\infty$ \\

mathbb\{R\} & $\mathbb{R}$ \\

mathbb\{N\} & $\mathbb{N}$ \\

mathbb\{Z\} & $\mathbb{Z}$ \\

\hline

\end{array}

\)

and there are lots more. Note that you would need to add "\" to the front of any of that 'code' to produce the actual symbol inside of a math tag. That should give you a good start though. Note that you don't need a symbol to to a 'less-than' or 'greater-than' because you already have '<' and '>' on your keyboards.

3) Subscript/Superscript/Other Modifiers

If you want to add a superscript or subscript LaTeX makes it easy. The superscript operator is '^' and the subscript operator is '_'. For example

Produces \(x^2\)

and
Produces \(x_i\). It's possible to have both.

Produces \(x^2_i\). If you want to have more than one character as part of your superscript or subscript you need to enclose the entire phrase in curly braces i.e.

Produces \(y^{3x - 5}_{max}\).

There are also other useful modifications one could want to make to symbols. A few of which are adding a bar, a hat, or making something bold. For example:

Produces \(\bar{x}\)

Produces \(\hat{y}\)

and for when you work with vectors a lot of times you want to make something bold to let people know that it's a vector. We can do something like that by using \mathbf{}. For example:

gives \(f(\mathbf{y} | \theta) = \prod_{i=1}^n f(y_i | \theta) \)

In LaTeX fractions have the same general form:

A few examples:

Produces \(\frac{7!}{2!(7-2)!}\)

Produces \( \frac{\beta^{\alpha}}{\Gamma (\alpha)} \)

If you want to write out some formulas involving integration then \int is your friend.

Produces \( \int x^2 dx = \frac{1}{3}x^3 + c \). It's easy enough to add limits to the integration using the superscript and subscripts we used before. For example:

Produces \( \int_{-\infty}^{\infty} \frac{1}{\sqrt{2 \pi}}e^{-\frac{x^2}{2}} dx = 1 \)

Our example will involve the binomial distribution:

Produces \( \sum_{x = 0}^n {n \choose{x}} p^x (1-p)^{n-x} \)

Limits get their own subsection for the sole reason that not everybody realizes that \lim is a latex command. Notice the difference between the following two examples

The first looks like this: \( lim_{x \rightarrow \infty}\) while the second looks much better: \( \lim_{x \rightarrow \infty}\)

When presenting data a lot of times it will look much nicer in tabular form. An example table:

Which will produce:

\(

\begin{array}{|l|cr|}

\hline

ID & Age & Weight \\

\hline

Ted & 25 & 180 \\

Frank & 52 & 169 \\

Sue & 32 & 125 \\

\hline

\end{array}

\)

You must start a table with the \begin{array} command. The portion directly after that (it looks like {|l|cr|} ) is quite customizable. What that part does is control how many columns the table will have, where you will have vertical lines, and how each column is justified. By adding the pipe character (it looks like '|' and is obtained by holding shift and hitting the key above 'enter') you add a vertical line to separate columns. The different letters (l, c, r) stand for "left", "center", and "right" justified. The command \hline tells the table when to add a horizontal line. Once you get to the portion of the table where you're actually adding data you separate the data between columns with the '&' character. You tell the table that you are finished with a row by ending it with two backslashes ("\\"). When you're finished with the table you need the \end{array} command.

Another example:

\(

\begin{array}{|c|c|c|}

\hline

Parameter & Point Estimate & 95\% Interval Estimate \\

\hline

$\beta_0$ & .503752 & (0.35280, 0.65470) \\

$\beta_1$ & .002229 & (0.00191, 0.00254) \\

$\beta_2$ & -1.286 & (-2.5331, -.038942) \\

\hline

\end{array}

\)

If you use R and want to create a table from some data you might be interested in the xtable package. It will automatically generate the latex code to create a table from your data which can save you lots of time copying/pasting and inserting various symbols.

There is a lot more you can do with LaTeX that went unmentioned. Hopefully you have a decent understand how to use some of the basic math typesetting available to you here.

Other references on how to use LaTeX:

http://www.artofproblemsolving.com/W.../LaTeX:Symbols

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

It should be noted that not all features of LaTeX are enabled in this web environment but you should be able to do almost anything you would want to post. If you have questions feel free to ask.

**Contents**- How do I use math tags?
- Symbols
- Subscript/Superscript/Other Modifiers
- Fractions/Integration/Summation/Limits
- Tables
- Misc.

**0.5) Why math tags? Why not tex tags?**The forum has both math and tex tags. However, the tex tags seem broken and don't properly render a lot

of stuff so we *highly* suggest using math tags instead of trying to get tex tags to work.

**1) How do I use math tags?**The forum includes typesetting using LaTex through the use of two special tags:

Code:

`[math]`

Code:

`[/math]`

A quick example - The following code:

Code:

`[math]Y_i = \mu_i + \epsilon_i[/math]`

There are various ways to see the code somebody else used to produce their mathematical typesetting. If you have javascript enabled you can click on their typesetting and a popup will display the code they used. If that doesn't work you can always 'quote' the post of interest and examine their post directly to see how they formatted it.

2) Symbols

There are many symbols that can be produced through the use of LaTeX. There are many guides on the internet that will show you the thousands of symbols that can be created. However, for a quick guide you can refer here or just browse other member's posts. It's not that bad and you can learn quickly. For a quick list of the more commonly used symbols you can refer below:

\(

\begin{array}{|l|c|}

\hline

Code & Result \\

\hline

alpha & $\alpha$ \\

beta & $\beta$ \\

epsilon & $\epsilon$ \\

lambda & $\lambda$ \\

mu & $\mu$ \\

sigma & $\sigma$ \\

theta & $\theta$ \\

chi & $\chi$ \\

\hline

\end{array}

\)

\(

\begin{array}{|l|c|}

\hline

Code & Result \\

\hline

cap & $\cap$ \\

cup & $\cup$ \\

cdot & $\cdot$ \\

cdots & $\cdots$ \\

ldots & $\ldots$ \\

\hline

\end{array}

\)

\(

\begin{array}{|l|c|}

\hline

Code & Result \\

\hline

leq & $\leq$ \\

geq & $\geq$ \\

neq & $\neq$ \\

subset & $\subset$ \\

sim & $\sim$ \\

equiv & $\equiv$ \\

propto & $\propto$ \\

\hline

\end{array}

\)

\(

\begin{array}{|l|c|}

\hline

Code & Results \\

\hline

exists & $\exists$ \\

forall & $\forall$ \\

infty & $\infty$ \\

mathbb\{R\} & $\mathbb{R}$ \\

mathbb\{N\} & $\mathbb{N}$ \\

mathbb\{Z\} & $\mathbb{Z}$ \\

\hline

\end{array}

\)

and there are lots more. Note that you would need to add "\" to the front of any of that 'code' to produce the actual symbol inside of a math tag. That should give you a good start though. Note that you don't need a symbol to to a 'less-than' or 'greater-than' because you already have '<' and '>' on your keyboards.

3) Subscript/Superscript/Other Modifiers

If you want to add a superscript or subscript LaTeX makes it easy. The superscript operator is '^' and the subscript operator is '_'. For example

HTML:

`[math]x^2[/math]`

and

HTML:

`[math]x_i[/math]`

HTML:

`[math]x^2_i[/math]`

HTML:

`[math]y^{3x - 5}_{max}[/math]`

There are also other useful modifications one could want to make to symbols. A few of which are adding a bar, a hat, or making something bold. For example:

HTML:

`[math]\bar{x}[/math]`

HTML:

`[math]\hat{y}[/math]`

and for when you work with vectors a lot of times you want to make something bold to let people know that it's a vector. We can do something like that by using \mathbf{}. For example:

HTML:

`[math]f(\mathbf{y} | \theta) = \prod_{i=1}^n f(y_i | \theta) [/math]`

**4) Fractions/Integration/Summation/Limits****Fractions**In LaTeX fractions have the same general form:

HTML:

`[math]\frac{numerator}{denominator} [/math]`

HTML:

`[math]\frac{7!}{2!(7-2)!}[/math]`

HTML:

`[math] \frac{\beta^{\alpha}}{\Gamma (\alpha)} [/math]`

**Integration**If you want to write out some formulas involving integration then \int is your friend.

HTML:

`[math] \int x^2 dx = \frac{1}{3}x^3 + c [/math]`

HTML:

`[math] \int_{-\infty}^{\infty} \frac{1}{\sqrt{2 \pi}}e^{-\frac{x^2}{2}} dx = 1 [/math]`

**Summation**Our example will involve the binomial distribution:

HTML:

` [math] \sum_{x = 0}^n {n \choose{x}} p^x (1-p)^{n-x} [/math]`

**Limits**Limits get their own subsection for the sole reason that not everybody realizes that \lim is a latex command. Notice the difference between the following two examples

HTML:

```
[math] lim_{x \rightarrow \infty}[/math]
[math] \lim_{x \rightarrow \infty}[/math]
```

**5) Tables**When presenting data a lot of times it will look much nicer in tabular form. An example table:

HTML:

```
[math]
\begin{array}{|l|cr|}
\hline
ID & Age & Weight \\
\hline
Ted & 25 & 180 \\
Frank & 52 & 169 \\
Sue & 32 & 125 \\
\hline
\end{array}
[/math]
```

\(

\begin{array}{|l|cr|}

\hline

ID & Age & Weight \\

\hline

Ted & 25 & 180 \\

Frank & 52 & 169 \\

Sue & 32 & 125 \\

\hline

\end{array}

\)

You must start a table with the \begin{array} command. The portion directly after that (it looks like {|l|cr|} ) is quite customizable. What that part does is control how many columns the table will have, where you will have vertical lines, and how each column is justified. By adding the pipe character (it looks like '|' and is obtained by holding shift and hitting the key above 'enter') you add a vertical line to separate columns. The different letters (l, c, r) stand for "left", "center", and "right" justified. The command \hline tells the table when to add a horizontal line. Once you get to the portion of the table where you're actually adding data you separate the data between columns with the '&' character. You tell the table that you are finished with a row by ending it with two backslashes ("\\"). When you're finished with the table you need the \end{array} command.

Another example:

HTML:

```
[math]
\begin{array}{|c|c|c|}
\hline
Parameter & Point Estimate & 95\% Interval Estimate \\
\hline
$\beta_0$ & .503752 & (0.35280, 0.65470) \\
$\beta_1$ & .002229 & (0.00191, 0.00254) \\
$\beta_2$ & -1.286 & (-2.5331, -.038942) \\
\hline
\end{array}
[/math]
```

\begin{array}{|c|c|c|}

\hline

Parameter & Point Estimate & 95\% Interval Estimate \\

\hline

$\beta_0$ & .503752 & (0.35280, 0.65470) \\

$\beta_1$ & .002229 & (0.00191, 0.00254) \\

$\beta_2$ & -1.286 & (-2.5331, -.038942) \\

\hline

\end{array}

\)

If you use R and want to create a table from some data you might be interested in the xtable package. It will automatically generate the latex code to create a table from your data which can save you lots of time copying/pasting and inserting various symbols.

**End Remarks**There is a lot more you can do with LaTeX that went unmentioned. Hopefully you have a decent understand how to use some of the basic math typesetting available to you here.

Other references on how to use LaTeX:

http://www.artofproblemsolving.com/W.../LaTeX:Symbols

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

It should be noted that not all features of LaTeX are enabled in this web environment but you should be able to do almost anything you would want to post. If you have questions feel free to ask.

Last edited by a moderator: