It is currently Wed May 22, 2019 12:44 am

All times are UTC [ DST ]

LaTeX & MathJaX Tutorial
LaTeX & MathJaX tutorial
The following page explains in detail how to properly use MathJaX and $\tLaTeX$ in forum. Should you have any questions please address them to the $\tLaTeX$ forum.

» Basic Tutorial
» Coloring Equations
» Cancellation and strike out abilities
» Special symbols and notations
» Matrices
» Commutative diagrams
» Enumeration of Equations
» Aligning Equations
» $\tLaTeX$ logos - MathJaX fonts

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". (When you do this, the '$' will not display. Make sure you add these. See the next point.)
  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, ..., \omega. They render as $\alpha, \beta, … \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. Parenteses: 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.
  8. Fonts: You have the ability to use the following fonts:
    • \mathbb{...} for "blackboard bold" letters.
    • \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 caligrafic 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 $\tLaTeX$ 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 ungly italicised 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 .
    • Note 1: The arguement of the functions is placed after leaving a space. For example $$\ln \left(x+\sqrt{x^2+1}\right)$$ is rendered by the code \ln \left(x+\sqrt{x^2+1}\right).
    • Note 2: If you would like to write the max, limit and sum operators in inline mode prefer to use them along with the \limits. command. There are many other commands to force the display mode in inline mode but this is the easier.
    • Note 3: Avoiding enforcing display mode in inline mode unless truly necessary. In case you want to do so invoke the \displaystyle command.
  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 arguement. For instance \sqrt[3]{x} renders as $\sqrt[3]{x}$.

Coloring 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}$$
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

Τhere are very large number of special symbols and notations, too many to list here; However some of them are:
  • \leq \geq produce $\leq$ and $\geq$ respectively.
  • \times \div \pm \mp produce $\times$, $\div$, $\pm$, $\mp$ respectively. Also \cdot produces entered dot, $x\cdot y$.
  • \cup \cap \setminus \subset \subseteq \subsetneq \supset \in \notin \emptyset produce $\cup$, $\cap$, $\setminus$, $\subset$, $\subseteq$, $\subsetneq$, $\supset$, $\in$, $\notin$, $\emptyset$ respectively. An alternative command for the empty set is \varnothing that renders as $\varnothing$.
  • For the binomial coefficient we use the command <\binom{n}{k} which renders as $\binom{n}{k}$.
  • \to \rightarrow \leftarrow \Rightarrow \Leftarrow \mapsto rendering as $\to\, \rightarrow\, \leftarrow\, \Rightarrow\, \Leftarrow\, \mapsto$ respectively.
  • \land \lor \lnot \forall \exists \top \bot \vdash \vDash rendering as $\land\, \lor\, \lnot\, \forall\, \exists\, \top\, \bot\, \vdash\, \vDash$ respectively.
  • \star \ast \oplus \circ \bullet rendering as $\star\, \ast\, \oplus\, \circ\, \bullet$ respectively.
  • \approx \sim \simeq \cong \equiv \prec rendering as $\approx\, \sim \, \simeq\, \cong\, \equiv\, \prec$ respectively.
  • \infty \aleph_0 render as $\infty\, \aleph_0$ , \nabla \partial render as $\nabla\, \partial$ and \Im \Re render as $\Im\, \Re$.

If you want to find more special symbols , then Detexify lets you draw a symbol on a web page and then lists the ${\rm \TeX}$ symbols that seem to resemble it. These are not guaranteed to work in MathJaX but are a good place to start. To check that a command is supported, note that maintains a list of current supported $\tLaTeX$ commands.


  1. Use $$\begin{matrix} ... \end{matrix}$$. In between the \begin and \end, put the matrix elements. End each matrix row with \\, and separate matrix elements with &. For example $$ \begin{matrix} 1 & x & x^2 \\ 1 & y & y^2 \\ 1 & z & z^2 \\ \end{matrix} $$ renders as $$ \begin{matrix} 1 & x & x^2 \\ 1 & y & y^2 \\ 1 & z & z^2 \\ \end{matrix} $$ MathJax will adjust the sizes of the rows and columns so that everything fits.
  2. To add brackets , replace matrix with pmatrix $\begin{pmatrix}1&2\\3&4\\ \end{pmatrix}$, bmatrix $\begin{bmatrix}1&2\\3&4\\ \end{bmatrix}$, Bmatrix $\begin{Bmatrix}1&2\\3&4\\ \end{Bmatrix}$, vmatrix $\begin{vmatrix}1&2\\3&4\\ \end{vmatrix}$, Vmatrix $\begin{Vmatrix}1&2\\3&4\\ \end{Vmatrix}$.
  3. Use \cdots $\cdots$, \ddots $\ddots$, \vdots $\vdots$ when you want to omit some of the entries: $$\begin{pmatrix} 1 & a_1 & a_1^2 & \cdots & a_1^n \\ 1 & a_2 & a_2^2 & \cdots & a_2^n \\ \vdots & \vdots& \vdots & \ddots & \vdots \\ 1 & a_m & a_m^2 & \cdots & a_m^n \end{pmatrix}$$
  4. For "augmented" matrices, put parentheses or brackets around a suitably-formatted table. For example: $$\left[\begin{array}{cc|c} 1&2&3\\ 4&5&6 \end{array}\right]$$ is produced by $$ \left[ \begin{array}{cc|c} 1&2&3\\ 4&5&6 \end{array} \right] $$. The cc|c is the crucial part here; it says that there are three centered columns with a vertical bar between the second and third.

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 }$$ $$\xymatrix{{\circ}\ar@/_/[d] \ar@/^/[rr]\ar@/_/[drr]& {\circ} & {\circ} \\{\circ}\ar@{..}[r] & {\circ}\ar@{..>}[u] & {\circ}\ar@3{<->}[u]}$$ More information (plus a turorial) on this package can be found here and here.

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 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}
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*}

Note: The usual $$ marks that delimit the display may be omitted here.

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}

$\tLaTeX$ logos - MathJaX fonts

There are two ways to write the $\tLaTeX$ logos in .
  • You may use \tLaTeX for displaysing the $\tLaTeX$ logo or,
  • \bLaTeX if you want the $\tLaTeX$ logo to be in bold. For instance $\bLaTeX$.

The main MathJaX font - currently running on - forum is STIX General. However, if your personal computer does not support it then MathJaX will display all formulae with its default font that is Web TeX font. If the mathematical formulae do not display properly then you can istall the STIX fonts and then MathJaX will use them. You may see the instructions on how to proceed with the installation.


This is a short intro on $\tLaTeX$ and MathJaX tutorial and it was last reviewed by: "mathimatikoi TM administrator team" on July 7, 2016. You are free to test any code you like at the LaTeX code testing's forum. Happy ${\rm \TeX}$ ing .

All times are UTC [ DST ]

Powered by phpBB® Forum Software © phpBB Group Color scheme created with Colorize It.
Theme created