Welcome to mathimatikoi.org;a forum of university mathematics. Enjoy your stay here.

LaTeX Tutorial

The following page explains in detail how to properly use MathJaX and LaTeX in mathimatikoi.org forum. Should you have any questions please address them to the LaTeX forum.

Basic Tutorial
  1. To see how any formula was written in any question or answer, including this one, right-click on the expression it and choose "Show Math As > TeX Commands".
  2. For inline formulae , enclose the formula in either $...$ or \( ... \). For displayed formulae use $$ ...$$ or \[...\]. They render differently. For instance $\gamma$ and

    $$\gamma \tag{displayed}$$
  3. For Greek letters, use \alpha, \beta, \gamma, \delta, \omega. They render as $\alpha, \beta, \gamma, \delta, \omega$. For uppercase use \Gamma, \Delta, ..., \Omega. Those render as $\Gamma, \Delta, ..., \Omega$.
  4. Groups: Superscripts, subscripts, and other operations apply only to the next “group”. A “group” is either a single symbol, or any formula surrounded by curly braces {...}. For example x_{ij} renders as $x_{ij}$. The same thing applies for powers.
  5. Parentheses: Ordinary symbols (...) and [...] make parentheses and brackets. For curly brackets use \{...\}. For instance \{a_n\}_{n=1}^{\infty} renders as $\{a_n\}_{n=1}^{\infty}$. If you want to scale them use \left\{ ... \right\}. Note however that this command do not scale the formula in between.
  6. Sums and Integrals: The basic command for sums is \sum followed by a subscript and a superscript, while the basic command of an integral is \int. To write a product use \prod. You can also write double and triple integrals by invoking the commands \iint or \iiint. They would render as $\sum, \; \int, \; \prod, \; \iint , \; \iiint$ and

    $$\sum, \; \int, \; \prod, \; \iint , \; \iiint$$

    respectively. You also have the ability to write contour integral by just typing \oint. It renders as

    $$\oint$$
  7. Fractions: The command that allows you to write a fraction is \frac{...}{...} where the dots are replaced by the nominator and denominator respectively. There is also the command \dfrac{...}{...} that renders as displayed fraction. It should be avoided most of the time.
  8. Fonts: You have the ability to use the following fonts:
    • \mathbb{...} for "blackboard bold" letters. For example $\mathbb{N}$ , $\mathbb{Z}$, $\mathbb{Q}$ , $\mathbb{R}$, $\mathbb{C}$.
    • \mathbf{...} for boldface letters. You can apply the command to small letters, e.g $\mathbf{a}$.
    • \mathtt{...} for "typewriter" type font letters.
    • \mathrm{...} for "Roman" type font letter. You can also apply the command to small letters, e.g $\mathrm{a}$.
    • \mathsf{...} for Sans Serif letters. You can also apply the command to small letters , e.g $\mathsf{a}$.
    • \mathcal{...} for caligraphic letters.
    • mathscr{...} for script letters.
    • \mathfrak{...} for fraktur letters (German Old Style). You can also apply the command to small letters, e.g $\mathfrak{c}$.
  9. Functions in LaTeX as written in a special way. We provide the codes for some of them: \sin \cos \tan \cot \lim \max \min \ln \log. They render as $\sin$ , $\cos$, $\tan$, $\cot$, $\lim$, $\max$, $\min$, $\ln$, $\log$ respectively. Don't forget to insert the backslash \ in front of them, because otherwise there'll be an ugly italicized result. MathJaX also supports other functions like the inverse trigonometric functions. To display them in a post simply use the commands \sinh , \cosh , \tanh , \arcsin, \arcsinh .
  10. Radical signs: You can also write radical equations, by just typing \sqrt[...]{...} where the first dot corresponds for the order of the radical while the second for its argument. For instance \sqrt[3]{x} renders as $\sqrt[3]{x}$.

Colouring equations

You can color your equation by just adding the command \color{color}{...}. For example \color{red}{\gamma-\gamma} renders as:

$$\color{red}{\gamma-\gamma}$$

A list of supported colors is the following:

$$\begin{array}{|rc|} \hline \verb+\color{black}{text}+ & \color{black}{text} \\ \verb+\color{gray}{text}+ & \color{gray}{text} \\ \verb+\color{silver}{text}+ & \color{silver}{text} \\ \verb+\color{white}{text}+ & \color{white}{text} \\ \hline \verb+\color{maroon}{text}+ & \color{maroon}{text} \\ \verb+\color{red}{text}+ & \color{red}{text} \\ \verb+\color{yellow}{text}+ & \color{yellow}{text} \\ \verb+\color{lime}{text}+ & \color{lime}{text} \\ \verb+\color{olive}{text}+ & \color{olive}{text} \\ \verb+\color{green}{text}+ & \color{green}{text} \\ \verb+\color{teal}{text}+ & \color{teal}{text} \\ \verb+\color{aqua}{text}+ & \color{aqua}{text} \\ \verb+\color{blue}{text}+ & \color{blue}{text} \\ \verb+\color{navy}{text}+ & \color{navy}{text} \\ \verb+\color{purple}{text}+ & \color{purple}{text} \\ \verb+\color{fuchsia}{text}+ & \color{magenta}{text} \\ \hline \end{array}$$

Tip: If you don't want to color any other equations, enclose your entire command in brackets.


Cancellation and strikeout abilities

You can cancel and strike out equations. This can be done using the commands:
  • \cancel{...}. For example \cancel{\gamma-\gamma} renders as $\cancel{\gamma-\gamma}$.
  • \bcancel{...}. For example \bcancel{\gamma-\gamma} renders as $\bcancel{\gamma-\gamma}$.
  • \xcancel{...}. For example \xcancel{\gamma-\gamma} renders as $\xcancel{\gamma-\gamma}$.
  • \cancelto{...}{...} cancels an equation to a number. For example \cancelto{0}{\gamma-\gamma} renders as $\cancelto{0}{\gamma-\gamma}$.
Further striking out capabilities are done by the \enclose command. For example:

$$\begin{array}{rl} \verb|\enclose{horizontalstrike}{x+y}| & \enclose{horizontalstrike}{x+y}\\ \verb|\enclose{verticalstrike}{\frac xy}| & \enclose{verticalstrike}{\frac xy}\\ \verb|\enclose{updiagonalstrike}{x+y}| & \enclose{updiagonalstrike}{x+y}\\ \verb|\enclose{downdiagonalstrike}{x+y}| & \enclose{downdiagonalstrike}{x+y}\\ \verb|\enclose{horizontalstrike,updiagonalstrike}{x+y}| & \enclose{horizontalstrike,updiagonalstrike}{x+y}\\ \end{array}$$


Special symbols and notations

You can find more symbols and notations at the integration equation editor at the posting_body of our forum.

Commutative Diagrams

You also have the ability of drawing commutative diagrams simply by invoking the xj.pic extension of MathJaX. Some examples drawn by this package are:

$$\xymatrix{ U \ar@/_/[ddr]_y \ar@/^/[drr]^x \ar@{.>}[dr]|-{(x,y)} \\ & X \times_Z Y \ar[d]^q \ar[r]_p & X \ar[d]_f \\ & Y \ar[r]^g & Z }$$

Enumeration of Equations

You can enumerate your equations either manually or automatically. To do it manually simply insert the command \tag{...}. This way the command f(x)=x^x \tag{*} will render as

$$f(x)=x^x \tag{*}$$

If you prefer to do it automatically though just enclose your latex commands within the \begin{equation} ... \end{equation} environment. This way you'll have:

\begin{equation} f(x)=x^x \end{equation}

Tip: Both methods work only in displaystyle mode. .

Aligning Equations

MathJaX also allows you to align equations. To get this, use \begin{align*} ... \end{align*}. Each line should end with \\ and should contain an ampersand at the point to align at, typically immediately before the equals sign. For example:

\begin{align*}
x+xy+y &=\sqrt{x^2}+ \sqrt{(xy)^2} + \sqrt{y^2} \\
&= \left | x \right |+ \left | xy \right |+ \left | y \right |
\end{align*}

is produced by:

\begin{align*} x+xy+y &=\sqrt{x^2}+ \sqrt{(xy)^2} + \sqrt{y^2} \\ &= \left | x \right |+ \left | xy \right |+ \left | y \right | \end{align*}

If you use \begin{align} ... \end{align} you will get an enumerated alignment. For example:

\begin{align}
x+xy+y &=\sqrt{x^2}+ \sqrt{(xy)^2} + \sqrt{y^2} \\
&= \left | x \right |+ \left | xy \right |+ \left | y \right |
\end{align}