An archive the questions from Mark's Fall 2018 Stat 225.

How do I input typeset mathematics?

admin

This site uses MathJax to create beautifully typeset mathematics.

  • For algebra
x=\frac{-b \pm \sqrt{b^2-4ac}}{2a}
  • For calculus
\int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}
  • And beyond
\left(\begin{matrix} 0&1&0 \\ 0&0&1 \\ 1&0&0 \end{matrix}\right) \left(\begin{matrix} x\\y\\z \end{matrix}\right) = \left(\begin{matrix} y\\z\\x \end{matrix}\right)

This type of math can be input in the editor in one of two syntaxes:

AsciiMath

AsciiMath is the easier and more flexible of the two input syntaxes to use. It is quite intuitive so that students can often pick it up quite easily. To enter the quadratic formula shown above, simply type

%x = (-b +- sqrt(b^2-4ac))/(2a).%

The percentage symbols are delimiters. Thus, the system typesets whatever comes between them. If you want to include a percentage symbol in your mathematics, you can escape it with a backslash. For example, to enter 50\%=1//2, you’d type

%50\%=1//2%

Note that we used a double slash 1//2 rather than a single to get an inline fraction rather than a stacked fraction like 1/2.

You can read more about AsciiMath at the AsciiMath homepage which includes much more information on the syntax and list of symbols that you can enter.

LaTeX

LaTeX input is a bit more complicated but also a bit more powerful. LaTeX is delimited with dollar signs so that f(x)=\sin(x^{12}) can be entered as $f(x)=\sin(x^{12})$. LaTeX distinguishes between inline mode (input with single dollar sign delimiters) and display mode (input with double dollar sign delimiters). Thus, we might input

\int_0^{\infty} e^{-x^2} dx = \frac{1}{2} \sqrt{\pi} \approx 0.886227.

as

$$
\int_0^{\infty} e^{-x^2} dx = \frac{1}{2} \sqrt{\pi} \approx 0.886227.
$$

Note that, unlike most LaTeX parsing system, the double dollar signs must appear on their own line.

Comparison

My recommendation to most beginners is to use AsciiMath, which tends to be easier and more intuitive. If you’re going on in mathematics, perhaps as a math major, learning LaTeX is quite worthwhile.