The Operations Research site supports MathJax and can be extended by adding packages. This FAQ gives an overview of how to use MathJax. If you want to add your own tips, please do so in separate answers.
6 Answers
There are some fantastic templates for MathJax formatting for linear programs on this thread on math meta. I'm copying and pasting here for easy viewing and editing.
Linear programming
Formulation
A theoretical LPP can be typeset as
\begin{array}{ll}
\text{maximize} & c^T x \\
\text{subject to}& d^T x = \alpha \\
&0 \le x \le 1.
\end{array}
\begin{array}{ll} \text{maximize} & c^T x \\ \text{subject to}& d^T x = \alpha \\ &0 \le x \le 1. \end{array}
To input a numerical LPP, use alignat
instead of align
to get better alignment between signs, variables and coefficients.
\begin{alignat}{5}
\max \quad & z = & x_1 & + & 12 x_2 & & & && \\
\mbox{s.t.} \quad & & 13 x_1 & + & x_2 & + & 12x_3 & \geq 5 && \tag{constraint 1} \\
& & x_1 & & & + & x_3 & \leq 16 && \tag{constraint 2} \\
& & 15 x_1 & + & 201 x_2 & & & = 14 && \tag{constraint 3} \\
& & \rlap{x_i \ge 0, i = 1, 2, 3}
\end{alignat}
\begin{alignat}{5} \max \quad & z = & x_1 & + & 12 x_2 & & & && \\ \mbox{s.t.} \quad & & 13 x_1 & + & x_2 & + & 12x_3 & \geq 5 && \tag{constraint 1} \\ & & x_1 & & & + & x_3 & \leq 16 && \tag{constraint 2} \\ & & 15 x_1 & + & 201 x_2 & & & = 14 && \tag{constraint 3} \\ & & \rlap{x_i \ge 0, i = 1, 2, 3} \end{alignat}
We treat $\max$, $z$, each variable, $\pm$ sign and RHS as one separate column, while leaving an extra empty column on the right. Then we count the number of separators &
, add one into this number then divide it by two. (e.g. (9 + 1) ÷ 2 = 5)
\rlap
is used so that the last row spans over one column.
Optional: \tag
is used to label the constraints.
Change MATLAB/Octave matrices to $\rm\LaTeX$ code
To get fractions, execute format rat
at the beginning.
Writing manually the $\rm\LaTeX$ code for a matrix with many rows and columns in Octave is tedious. The Octave function
strcat("\\begin{bmatrix}\n",strrep(strrep(mat2str(A)," "," & "), ...
";"," \\\\\n")(2:end-1),"\n\\end{bmatrix}\n")
converts
A = [1 2 2; 2 3 4; 4 4 2]
A =
1 2 2
2 3 4
4 4 2
to
\begin{bmatrix}
1 & 2 & 2 \\
2 & 3 & 4 \\
4 & 4 & 2
\end{bmatrix}
so that pasting the generated code gives
$$ \begin{bmatrix} 1 & 2 & 2 \\ 2 & 3 & 4 \\ 4 & 4 & 2 \end{bmatrix}. $$
Simplex tableaux
Since the coefficient of the objective value variable $z$ never changes, my habit is to omit the $z$-column to save ink.
Normal simplex tableau
\begin{array}{rrrrrr|r}
& x_1 & x_2 & s_1 & s_2 & s_3 & \\ \hline
s_1 & 0 & 1 & 1 & 0 & 0 & 8 \\
s_2 & 1 & -1 & 0 & 1 & 0 & 4 \\
s_3 & 1 & 1 & 0 & 0 & 1 & 12 \\ \hline
& -1 & -1 & 0 & 0 & 0 & 0
\end{array}
\begin{array}{rrrrrr|r} & x_1 & x_2 & s_1 & s_2 & s_3 & \\ \hline s_1 & 0 & 1 & 1 & 0 & 0 & 8 \\ s_2 & 1 & -1 & 0 & 1 & 0 & 4 \\ s_3 & 1 & 1 & 0 & 0 & 1 & 12 \\ \hline & -1 & -1 & 0 & 0 & 0 & 0 \end{array}
It can be stacked up to give an illustration of the entering of variables at different stages.
\begin{array}{rrrrrrr|rr}
& x_1 & x_2 & s_1 & s_2 & s_3 & w & & \text{ratio} \\ \hline
s_1 & 0 & 1 & 1 & 0 & 0 & 0 & 8 & - \\
w & 1^* & -1 & 0 & -1 & 0 & 1 & 4 & 4 \\
s_3 & 1 & 1 & 0 & 0 & 1 & 0 & 12 & 12 \\ \hdashline
& 1 & -1 & 0 & -1 & 0 & 0 & 4 & \\ \hline
s_1 & 0 & 1 & 1 & 0 & 0 & 0 & 8 & \\
x_1 & 1 & -1 & 0 & -1 & 0 & 1 & 4 & \\
s_3 & 0 & 2 & 0 & 2 & 1 & -1 & 8 & \\ \hdashline
& 0 & 0 & 0 & 0 & 0 & -1 & 0 &
\end{array}
\begin{array}{rrrrrrr|rr} & x_1 & x_2 & s_1 & s_2 & s_3 & w & & \text{ratio} \\ \hline s_1 & 0 & 1 & 1 & 0 & 0 & 0 & 8 & - \\ w & 1^* & -1 & 0 & -1 & 0 & 1 & 4 & 4 \\ s_3 & 1 & 1 & 0 & 0 & 1 & 0 & 12 & 12 \\ \hdashline & 1 & -1 & 0 & -1 & 0 & 0 & 4 & \\ \hline s_1 & 0 & 1 & 1 & 0 & 0 & 0 & 8 & \\ x_1 & 1 & -1 & 0 & -1 & 0 & 1 & 4 & \\ s_3 & 0 & 2 & 0 & 2 & 1 & -1 & 8 & \\ \hdashline & 0 & 0 & 0 & 0 & 0 & -1 & 0 & \end{array}
Dual simplex tableau
\begin{array}{rrrrrrrr|r}
& x_1 & x_2 & x_3 & x_4 & x_5 & x_6 & x_7 & \\ \hline
x_4 & 0 & -3 & 7 & 1 & 0 & 0 & 2 & 2M -4 \\
x_5 & 0 & -9 & 0 & 0 & 1 & 0 & -1 & -M -3 \\
x_6 & 0 & 6 & -1 & 0 & 0 & 1 & -4^* & -4M +8 \\
x_1 & 1 & 0 & 1 & 0 & 0 & 0 & 1 & M \\ \hline
& 0 & 1 & 1 & 0 & 0 & 0 & 2 & 2M \\
\text{ratio} & & & 1 & & & & 1/2 &
\end{array}
\begin{array}{rrrrrrrr|r} & x_1 & x_2 & x_3 & x_4 & x_5 & x_6 & x_7 & \\ \hline x_4 & 0 & -3 & 7 & 1 & 0 & 0 & 2 & 2M -4 \\ x_5 & 0 & -9 & 0 & 0 & 1 & 0 & -1 & -M -3 \\ x_6 & 0 & 6 & -1 & 0 & 0 & 1 & -4^* & -4M +8 \\ x_1 & 1 & 0 & 1 & 0 & 0 & 0 & 1 & M \\ \hline & 0 & 1 & 1 & 0 & 0 & 0 & 2 & 2M \\ \text{ratio} & & & 1 & & & & 1/2 & \end{array}
It can be stacked up to give a theoretical illustration of what happens in the upcoming steps.
\begin{array}{rrrrrrr|r} & x_1 & x_2 & x_3 & s_1 & s_2 & s_3 & \\ \hline s_1 & -2 & 0 & -2 & 1 & 0 & 0 & -60 \\ s_2 & -2 & -4^* & -5 & 0 & 1 & 0 & -70 \\ s_3 & 0 & -3 & -1 & 0 & 0 & 1 & -27 \\ \hdashline & 8 & 10 & 25 & 0 & 0 & 0 & 0 \\ \text{ratio} & -4 & -5/2 & -5 & & & & \\ \hline s_1 & -2^* & 0 & -2 & 1 & 0 & 0 & -60 \\ x_2 & 1/2 & 1 & 5/4 & 0 & -1/4 & 0 & 35/2 \\ s_3 & 3/2 & 0 & 11/4 & 0 & -3/4 & 1 & 51/2 \\ \hdashline & 3 & 0 & 25/2 & 0 & 5/2 & 0 & -175 \\ \text{ratio} & -3/2 & & 25/4 & & & & \\ \hline x_1 & 1 & 0 & 1 & -1/2 & 0 & 0 & 30 \\ x_2 & 0 & 1 & 3/4 & 1/4 & -1/4 & 0 & 5/2 \\ s_3 & 0 & 0 & 5/4 & 3/4 & -3/4^* & 1 & -39/2 \\ \hdashline & 0 & 0 & 19/2 & 3/2 & 5/2 & 0 & -265 \\ \text{ratio} & & & & & \dots & & \\ \hline x_1 & 1 & 0 & 1 & -1/2 & 0 & 0 & 30 \\ x_2 & 0 & 1 & 1/3 & 0 & 0 & -1/3 & 9 \\ s_2 & 0 & 0 & -5/3 & -1 & 1 & -4/3 & 26 \\ \hdashline & 0 & 0 & 41/3 & 4 & 0 & 10/3 & -330 \end{array}
Duality
A picture is worth a thousand words.
$$ \require{extpfeil} % produce extensible horizontal arrows \begin{array}{ccc} % arrange LPPs % first row % first LPP \begin{array}{ll} \max & z = c^T x \\ \text{s.t.} & A x \le b \\ & x \ge 0 \end{array} & \xtofrom{\text{duality}} & % second LPP \begin{array}{ll} \min & v = b^T y \\ \text{s.t.} & A^T y \ge c \\ & y \ge 0 \end{array} \\ ({\cal PC}) & & ({\cal DC}) \\ \text{add } {\Large \downharpoonleft} \text{slack var} & & \text{minus } {\Large \downharpoonright} \text{surplus var}\\ % Change to your favorite arrow style % % second row % third LPP \begin{array}{ll} \max & z = c^T x \\ \text{s.t.} & A x + s = b \\ & x,s \ge 0 \end{array} & \xtofrom[\text{some steps skipped}]{\text{duality}} & % fourth LPP \begin{array}{ll} \min & v = b^T y \\ \text{s.t.} & A^T y - t = c \\ & y,t \ge 0 \end{array} \\ ({\cal PS}) & & ({\cal DS}) % \end{array} $$
-
$\begingroup$ @Rob I can't tell, are you saying I did it right, or I did it wrong? $\endgroup$ May 30, 2019 at 22:34
-
4$\begingroup$ Nice post, but tableaus (tableaux) should have been dead and buried by the '80s, if not the '70s. $\endgroup$ May 31, 2019 at 0:49
MathJax commands available here:
(Deutsch: MathJax: LaTeX Basic Tutorial und Referenz)
If you don't find exactly what you are looking for in this first section there are links near the bottom of this answer which enumerate every possible MathJax command. This answer can't include every symbol as it would bog down page loading times.
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.)
For inline formulas, enclose the formula in
$...$
. For displayed formulas, use$$...$$
.
These render differently. For example, type
$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$
to show $\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$ (which is inline mode) or type
$$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$
to show $$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$ (which is display mode).For Greek letters, use
\alpha
,\beta
, …,\omega
: $\alpha, \beta, … \omega$. For uppercase, use\Gamma
,\Delta
, …,\Omega
: $\Gamma, \Delta, …, \Omega$.For superscripts and subscripts, use
^
and_
. For example,x_i^2
: $x_i^2$,\log_2 x
: $\log_2 x$.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
{
…}
. If you do10^10
, you will get a surprise: $10^10$. But10^{10}
gives what you probably wanted: $10^{10}$. Use curly braces to delimit a formula to which a superscript or subscript applies:x^5^6
is an error;{x^y}^z
is ${x^y}^z$, andx^{y^z}
is $x^{y^z}$. Observe the difference betweenx_i^2
$x_i^2$ andx_{i^2}
$x_{i^2}$.Parentheses Ordinary symbols
()[]
make parentheses and brackets $(2+3)[4+4]$. Use\{
and\}
for curly braces $\{\}$.These do not scale with the formula in between, so if you write
(\frac{\sqrt x}{y^3})
the parentheses will be too small: $(\frac{\sqrt x}{y^3})$. Using\left(
…\right)
will make the sizes adjust automatically to the formula they enclose:\left(\frac{\sqrt x}{y^3}\right)
is $\left(\frac{\sqrt x}{y^3}\right)$.\left
and\right
apply to all the following sorts of parentheses:(
and)
$(x)$,[
and]
$[x]$,\{
and\}
$\{ x \}$,|
$|x|$,\vert
$\vert x \vert$,\Vert
$\Vert x \Vert$,\langle
and\rangle
$\langle x \rangle$,\lceil
and\rceil
$\lceil x \rceil$, and\lfloor
and\rfloor
$\lfloor x \rfloor$.\middle
can be used to add additional dividers. There are also invisible parentheses, denoted by.
:\left.\frac12\right\rbrace
is $\left.\frac12\right\rbrace$.If manual size adjustments are required:
\Biggl(\biggl(\Bigl(\bigl((x)\bigr)\Bigr)\biggr)\Biggr)
gives $\Biggl(\biggl(\Bigl(\bigl((x)\bigr)\Bigr)\biggr)\Biggr)$.Sums and integrals
\sum
and\int
; the subscript is the lower limit and the superscript is the upper limit, so for example\sum_1^n
$\sum_1^n$. Don't forget{
…}
if the limits are more than a single symbol. For example,\sum_{i=0}^\infty i^2
is $\sum_{i=0}^\infty i^2$. Similarly,\prod
$\prod$,\int
$\int$,\bigcup
$\bigcup$,\bigcap
$\bigcap$,\iint
$\iint$,\iiint
$\iiint$.Fractions There are two ways to make these.
\frac ab
applies to the next two groups, and produces $\frac ab$; for more complicated numerators and denominators use{
…}
:\frac{a+1}{b+1}
is $\frac{a+1}{b+1}$. If the numerator and denominator are complicated, you may prefer\over
, which splits up the group that it is in:{a+1\over b+1}
is ${a+1\over b+1}$.Fonts
- Use
\mathbb
or\Bbb
for "blackboard bold": $\mathbb{CHNQRZ}$. - Use
\mathbf
for boldface: $\mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$ $\mathbf{abcdefghijklmnopqrstuvwxyz}$. - Use
\mathtt
for "typewriter" font: $\mathtt{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$ $\mathtt{abcdefghijklmnopqrstuvwxyz}$. - Use
\mathrm
for roman font: $\mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$ $\mathrm{abcdefghijklmnopqrstuvwxyz}$. - Use
\mathsf
for sans-serif font: $\mathsf{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$ $\mathsf{abcdefghijklmnopqrstuvwxyz}$. - Use
\mathcal
for "calligraphic" letters: $\mathcal{ ABCDEFGHIJKLMNOPQRSTUVWXYZ}$ - Use
\mathscr
for script letters: $\mathscr{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$ - Use
\mathfrak
for "Fraktur" (old German style) letters: $\mathfrak{ABCDEFGHIJKLMNOPQRSTUVWXYZ} \mathfrak{abcdefghijklmnopqrstuvwxyz}$.
- Use
Radical signs Use
sqrt
, which adjusts to the size of its argument:\sqrt{x^3}
$\sqrt{x^3}$;\sqrt[3]{\frac xy}
$\sqrt[2]{\frac xy}$. For complicated expressions, consider using{...}^{1/2}
instead.Some special functions such as "lim", "sin", "max", "ln", and so on are normally set in roman font instead of italic font. Use
\lim
,\sin
, etc. to make these:\sin x
$\sin x$, notsin x
$sin x$. Use subscripts to attach a notation to\lim
:\lim_{x\to 0}
$$\lim_{x\to 0}$$There are a very large number of special symbols and notations, too many to list here; see this shorter listing, or this exhaustive listing. Some of the most common include:
\lt \gt \le \ge \neq
$\lt\, \gt\, \le\, \ge\, \neq$. You can use\not
to put a slash through almost anything:\not\lt
$\not\lt$ but it often looks bad (also see two lines down).\lessapprox
⪅\gtrapprox
⪆\lesssim
≲\gtrsim
≳\lnapprox
⪉\gnapprox
⪊\lnsim
⋦\gnsim
⋧\times \div \pm \mp
$\times\, \div\, \pm\, \mp$.\cdot
is a centered dot: $x\cdot y$\cup \cap \setminus \subset \subseteq \subsetneq \supset \in \notin \emptyset \varnothing
$\cup\, \cap\, \setminus\, \subset\, \subseteq \,\subsetneq \,\supset\, \in\, \notin\, \emptyset\, \varnothing${n+1 \choose 2k}
or\binom{n+1}{2k}
${n+1 \choose 2k}$\to \rightarrow \leftarrow \Rightarrow \Leftarrow \mapsto
$\to\, \rightarrow\, \leftarrow\, \Rightarrow\, \Leftarrow\, \mapsto$\land \lor \lnot \forall \exists \top \bot \vdash \vDash
$\land\, \lor\, \lnot\, \forall\, \exists\, \top\, \bot\, \vdash\, \vDash$\star \ast \oplus \circ \bullet
$\star\, \ast\, \oplus\, \circ\, \bullet$\approx \sim \simeq \cong \equiv \prec \lhd
$\approx\, \sim \, \simeq\, \cong\, \equiv\, \prec, \lhd$.\infty \aleph_0
$\infty\, \aleph_0$\nabla \partial
$\nabla\, \partial$\Im \Re
$\Im\, \Re$- For modular equivalence, use
\pmod
like this:a\equiv b\pmod n
$a\equiv b\pmod n$. \ldots
is the dots in $a_1, a_2, \ldots ,a_n$\cdots
is the dots in $a_1+a_2+\cdots+a_n$- Some Greek letters have variant forms:
\epsilon \varepsilon
$\epsilon\, \varepsilon$,\phi \varphi
$\phi\, \varphi$, and others. Script lowercase l is\ell
$\ell$.
Detexify lets you draw a symbol on a web page and then lists the $\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 MathJax.org maintains a list of currently supported $\LaTeX$ commands, and one can also check Dr. Carol JVF Burns's page of $\TeX$ Commands Available in MathJax or the list on Michael Downes "Math Symbol and Math Fonts" website.
Spaces MathJax usually decides for itself how to space formulas, using a complex set of rules. Putting extra literal spaces into formulas will not change the amount of space MathJax puts in:
a␣b
anda␣␣␣␣b
are both $a b$. To add more space, use\,
for a thin space $a\,b$;\;
for a wider space $a\;b$.\quad
and\qquad
are large spaces: $a\quad b$, $a\qquad b$.
To reduce the space between a series of MathJax commands and a following word (doesn't work well with punctuation) use \!
as many times as necessary.
To set plain text, use \text{…}
: $\{x\in s\mid x\text{ is extra large}\}$. You can nest $…$
inside of \text{…}
.
- Accents and diacritical marks Use
\hat
for a single symbol $\hat x$,\widehat
for a larger formula $\widehat{xy}$. If you make it too wide, it will look silly. Similarly, there are\bar
$\bar x$ and\overline
$\overline{xyz}$, and\vec
$\vec x$ and\overrightarrow
$\overrightarrow{xy}$ and\overleftrightarrow
$\overleftrightarrow{xy}$. For dots, as in $\frac d{dx}x\dot x = \dot x^2 + x\ddot x$, use\dot
and\ddot
.
Accents from "Math symbols and math fonts" by Michael Downes:
\acute{x}
$\acute{x}$ \bar{x}
$\bar{x}$ \vec{x}
$\vec{x}$ \widetilde{xxx}
$\widetilde{xxx}$ \grave{x}
$\grave{x}$ \breve{x}
$\breve{x}$
\dot{x}
$\dot{x}$ \widehat{xxx}
$\widehat{xxx}$ \ddot{x}
$\ddot{x}$ \check{x}
$\check{x}$ \ddot{x}
$\ddot{x}$ \tilde{x}
$\tilde{x}$
\hat{x}
$\hat{x}$ \dddot{x}
$\dddot{x}$
- Special characters used for MathJax interpreting can be escaped using the
\
character:\$
$\$$,\{
$\{$,\_
$\_$, etc. If you want\
itself, you should use\backslash
$\backslash$, because\\
is for a new line.
Additional examples from math.stackexchange.com showing how to draw commutative diagrams using \array or \newcommand:
$$
\newcommand{\ra}[1]{\!\!\!\!\!\!\!\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!\!\!\!}
\newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.}
%
\begin{array}{llllllllllll} 0 & \ra{f_1} & A & \ra{f_2} & B & \ra{f_3} & C & \ra{f_4} & D & \ra{f_5} & 0 \\
\da{g_1} & & \da{g_2} & & \da{g_3} & & \da{g_4} & & \da{g_5} & & \da{g_6} \\
0 & \ra{h_1} & 0 & \ra{h_2} & E & \ra{h_3} & F & \ra{h_4} & 0 & \ra{h_5} & 0 \\
\end{array}
$$
$$ \newcommand{\ra}[1]{\!\!\!\!\!\!\!\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{llllllllllll} 0 & \ra{f_1} & A & \ra{f_2} & B & \ra{f_3} & C & \ra{f_4} & D & \ra{f_5} & 0 \\ \da{g_1} & & \da{g_2} & & \da{g_3} & & \da{g_4} & & \da{g_5} & & \da{g_6} \\ 0 & \ra{h_1} & 0 & \ra{h_2} & E & \ra{h_3} & F & \ra{h_4} & 0 & \ra{h_5} & 0 \\ \end{array} $$
$$
\begin{array}{ccccccccc}
0 & \xrightarrow{i} & A & \xrightarrow{f} & B & \xrightarrow{q} & C & \xrightarrow{d} & 0 \\
\downarrow & \searrow & \downarrow & \nearrow & \downarrow & \searrow & \downarrow & \nearrow & \downarrow \\
0 & \xrightarrow{j} & D & \xrightarrow{g} & E & \xrightarrow{r} & F & \xrightarrow{e} & 0
\end{array}
$$
$$ \begin{array}{ccccccccc} 0 & \xrightarrow{i} & A & \xrightarrow{f} & B & \xrightarrow{q} & C & \xrightarrow{d} & 0 \\ \downarrow & \searrow & \downarrow & \nearrow & \downarrow & \searrow & \downarrow & \nearrow & \downarrow \\ 0 & \xrightarrow{j} & D & \xrightarrow{g} & E & \xrightarrow{r} & F & \xrightarrow{e} & 0 \end{array} $$
The word on Tables: Is there Markdown to create tables? - ASCII only, real Tables were denied.
Our whitelisted subset of HTML: What HTML tags are allowed on Stack Exchange sites?
The enormous list of $\TeX$ commands allowed in MathJax.
Michael Downes of the American Mathematical Society has a useful MathJax website.
Another plethora of tips are offered on the LaTeX - Mathematics: Fractions and Binomials Wiki.
Hacking the quod erat demonstrandum symbol is discussed here: "\qed for MathJax here on stackexchange" - Spoiler: $$\tag*{$\blacksquare$}$$
$$\tag*{$\blacksquare$}$$
Example - Adding a new extension:
Typesetting chemistry in MathJax:
The LaTeX package
mhchem
is not activated here, by default. However, you can load it yourself, by using the command\require{\mhchem}
(you need to use it only once on a page).Example:
\require{\mhchem}\ce{H2O}
generates generates $\text{H}_{_2}\!\text{O}$.
Courtesy: @DavidCervone on Physics SE
If you know of additional packages that are both supported and on-topic please add them, Chemistry was added as an example of how to add a package; not for its usefulness specific to Operations Research. (Borrowed from Quantum Computing Meta).
Another additional package is \require{enclose} - Example (to red-circle / box a portion of an equation). The packages bussproofs and physics may also prove useful. There's a full list here but all those extensions may not be available in our version of MathJax (or work bug free).
There's a question with a dozen informative answers at Chemistry.SE's question: "What additional formatting features are available to MathJax (possibly via \require{})?".
$$ %% %% Example 01-17-3 %% Copyright (C) 2017 Herbert Voss %% %% ==== % Show page(s) 1 %% %% %\documentclass[]{exaarticle} %\pagestyle{empty} %\setlength\textwidth{328.62788pt} %\usepackage[T1]{fontenc} %StartShownPreambleCommands %\usepackage{capt-of} %StopShownPreambleCommands %\begin{document} %\tabcolsep=3pt %\captionof{table}{The greek letters of Latin Modern} \\ \text{The greek letters of Latin Modern} $$ $$ %\smallskip %\begin{tabular}{@{} lclccc @{}}\hline \begin{array}{} \text{lower} & \text{default} & \text{upper} & \text{default} & \verb|\mathbf| & \verb|\mathit|\\\hline \verb|\alpha| & $\alpha$ \\ \verb|\beta| & $\beta$ \\ \verb|\gamma| & $\gamma$ & \verb|\Gamma| & $\Gamma$ & $\mathbf{\Gamma}$ & $\mathit{\Gamma}$\\ \verb|\delta| & $\delta$ & \verb|\Delta| & $\Delta$ & $\mathbf{\Delta}$ & $\mathit{\Delta}$\\ \verb|\epsilon| & $\epsilon$\\ \verb|\varepsilon| & $\varepsilon$\\ \verb|\zeta| & $\zeta$\\ \verb|\eta| & $\eta$ \\ \verb|\theta| & $\theta$ & \verb|\Theta| & $\Theta$ & $\mathbf{\Theta}$ & $\mathit{\Theta}$\\ \verb|\vartheta| & $\vartheta$\\ \verb|\iota| & $\iota$\\ \verb|\kappa| & $\kappa$\\ \verb|\lambda| & $\lambda$ & \verb|\Lambda| & $\Lambda$ & $\mathbf{\Lambda}$ & $\mathit{\Lambda}$\\ \verb|\mu| & $\mu$ \\ \verb|\nu| & $\nu$\\ \verb|\xi| & $\xi$ & \verb|\Xi| & $\Xi$ & $\mathbf{\Xi}$ & $\mathit{\Xi}$\\ \verb|\pi| & $\pi$ & \verb|\Pi| & $\Pi$ & $\mathbf{\Pi}$ & $\mathit{\Pi}$\\ \verb|\varpi| & $\varpi$ \\ \verb|\rho| & $\rho$\\ \verb|\varrho| & $\varrho$\\ \verb|\sigma| & $\sigma$ & \verb|\Sigma| & $\Sigma$ & $\mathbf{\Sigma}$ & $\mathit{\Sigma}$\\ \verb|\varsigma| & $\varsigma$\\ \verb|\tau| & $\tau$\\ \verb|\upsilon| & $\upsilon$ & \verb|\Upsilon| & $\Upsilon$ & $\mathbf{\Upsilon}$ & $\mathit{\Upsilon}$\\ \verb|\phi| & $\phi$ & \verb|\Phi| & $\Phi$ & $\mathbf{\Phi}$ & $\mathit{\Phi}$\\ \verb|\varphi| & $\varphi$\\ \verb|\chi| & $\chi$ \\ \verb|\psi| & $\psi$ & \verb|\Psi| & $\Psi$ & $\mathbf{\Psi}$ & $\mathit{\Psi}$\\ \verb|\omega| & $\omega$ & \verb|\Omega| & $\Omega$ & $\mathbf{\Omega}$ & $\mathit{\Omega}$\\\hline %\end{tabular} \end{array} %\end{document} $$
While editing an answer for the question: "Bin Packing with Relational Penalization" our moderator @TheSimpliFire discovered a grammatical error in our site's version of MathJax. This invites the question: "Which version of MathJax does Stack Exchange use?".
I searched to find if there was any command one could use to cause MathJax to display its version (like the $\LaTeX$ and $\TeX$ trick, written by using \$\LaTeX\$ or \$\TeX\$) but it appears that there is no such command. Still it is possible to click on a page's MathJax and display that information by clicking on "About MathJax":
MathJax v2.7.5 (July 20, 2018)
using web TeX fonts
MathJax.js v2.7.5
TeX Input Jax v2.7.5
HTML-CSS Output Jax v2.7.5
PreviewHTML Output Jax v2.7.5
mml Element Jax v2.7.5
AssistiveMML Extension v2.7.5
MathEvents Extension v2.7.5
MathMenu Extension v2.7.5
MathZoom Extension v2.7.5
TeX/AMSmath Extension v2.7.5
TeX/AMSsymbols Extension v2.7.5
TeX/begingroup Extension v2.7.5
TeX/extpfeil Extension v2.7.5
TeX/mhchem Extension v2.7.5
TeX/newcommand Extension v2.7.5
TeX/noErrors Extension v2.7.5
TeX/noUndefined Extension v2.7.5
TeX/verb Extension v2.7.5
accessibility-menu Extension v1.5.0
fast-preview Extension v2.7.5
tex2jax Extension v2.7.5
Firefox v68.0 — woff or otf fonts
MathJax version 2.7.5 has (claimed) 0 issues open, MathJax version 3 had (when this answer was last edited) 31 issues open (Nov 23, 2019), currently (Sept 7, 2022) there are 13 issues open.
There are aids available to convert drawings, PDFs, and images to MathJax:
Detexify - Draw a shape or symbol and it is converted to the closest (guessed) MathJax equivalent.
ShapeCatcher - Draw a shape or symbol and it is converted to the closest (guessed) Unicode symbol.
Mathpix - Convert PDFs, images, and more to MathJax using an Android or Apple application. Free and paid versions available.