From Nxt Wiki
Jump to: navigation, search
This page contains changes which are not marked for translation.

1 What is LaTeX?

LaTeX is a markup language, like HTML and wiki markup. It's very handy for describing and displaying math formulas.

2 Getting Started

All wiki LaTeX expressions lie between <math> and </math> tags. Let's start with simple examples and work our way up.

Description You type You get
LaTeX makes numbers and symbols look prettier.

Letters are italicized to look like variables.

<math>y = x - 2z + 13</math> y = x - 2z + 13
^ for exponents

_ for subscripts

<math>y^2 = x^3 - 486662x + x</math> y^2 = x^3 - 486662x^2 + x
LaTeX is quite dumb, it treats adjacent symbols separately, rather than as a single term. <math>y^2n</math> y^2n
Use curly braces to group them together <math>y^{2n}</math> y^{2n}

3 Easy ways to learn how to write math using LaTeX

The easiest way to learn LaTeX math is to look at how other people write it. The "source code" for documents prepared using LaTeX usually end in .tex. These are plaintext files that can be read in any text editor. You can also see how other people write it in the wiki by clicking on the Edit Page tab.

Mathematical expressions in .tex files don't lie between <math> and </math> tags. Instead, they may look like

$ O(n \log n) $

$$ \gcd(a, b) = 1 $$

x^2 & > 0 \\
x & \neq 0

Remember to convert to the correct tags. In the last example, & and \\ are alignment and newline operators and should also be removed when converting to wiki LaTeX.

4 Commonly Used Commands

Description You type You get
Fractions \frac{n}{2} \frac{n}{2}
Large delimiters (\frac{n}{2})

\bigl( \frac{n}{2} \bigr)
\Bigl( \frac{n}{2} \Bigr)


\bigl( \frac{n}{2} \bigr)
\Bigl( \frac{n}{2} \Bigr)

Floor and Ceiling \Bigl \lfloor \frac{n}{2} \Bigr \rfloor

\lceil \sqrt{n} \rceil

\Bigl \lfloor \frac{n}{2} \Bigr \rfloor

 \lceil \sqrt{n} \rceil

Summation \sum_{i=1}^n i^3 = (\sum_{i=1}^n i)^2 \sum_{i=1}^n i^3 = (\sum_{i=1}^n i)^2

For more commands, check out the excellent Short Math Guide for Latex by Michael Downes.