Skip to main content

MathJax on Blogger Cheatsheet



1. Placement
$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$ will generate the formula inline \(\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}\) of a paragraph, where $$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$ will render the formula as a seperate image $$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$ and not inline to the paragraph.

2. Greek letters
For Greek letters, use
  1. $\alpha$ \(\alpha\)
  2. $\beta$ \(\beta\)
  3. $\delta$ \(\delta\) or $\Delta$ \(\Delta\)
  4. $\gamma$ \(\gamma\) or $\Gamma$ \(\Gamma\)
  5. $\ldots$ \(\ldots\)
  6. $\omega$ \(\omega\) or $\Omega$ \(\Omega\)

3. Superscripts and subscripts

For superscripts and subscripts, use ^ and _.
  1. $x_i^2$ \(x_i^2\)
  2. $\log_2x$ \(\log_2x\)

4. Grouping

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 do $10^10$, you will get a surprise: \(10^10\). But 10^{10} gives what you probably wanted: \(10^{1-}\).

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\), and $x^{y^z}$ is \(x^{y^z}\).

Observe the difference between $x_i^2$ \(x_i^2\) and $x_{i^2}$ \(x_{i^2}\).

5. Parentheses

Ordinary symbols $()[]$ make parentheses and brackets \((2+3)[4+4](2+3)[4+4]\).

Use $\{$ and $\}$ for curly braces \(\{\ldots\}\) and use $\($ and $\)$ for round braces \((\ldots)\).

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$ and $\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)\).

6. 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$ renders as \(\sum_1^n\).

Remember that {…} if the limits are more than a single symbol. For example, $\sum_{i=0}^\infty i^2$ renders as \(\sum_{i=0}^\infty i^2\).

Similarly, $\prod$ \(\prod\), $\int$ \(\int\), $\bigcup$ \(\bigcup\), $\bigcap$ \(\bigcup\) and/or \iint \(\iint\).

7. Fractions

There are two approaches
  1. $\frac ab$ applies to the next two groups renders as \(\frac ab\); and
  2. more complicated numerators and denominators use $/{…/}$
, eg. $\frac{a+1}{b+1}$ renders as \(\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, eg. ${a+1\over b+1}$ renders as \({a+1\over b+1}\).

8. Radical signs

Use $\sqrt$, which adjusts to the size of its argument, eg. $\sqrt{x^3}$ renders as \(\sqrt{x^3}\) and $\sqrt[3]{\frac xy}$ renders as \(\sqrt[3]{\frac xy}\).

For complicated expressions, consider using ${...}^{1/2}$ instead.

9. Special functions

Such as $\lim$, $\sin$, $\max$, $\ln$, etc. are normally set in roman font instead of italic font. $\sin x$ renders as \(\sin x\), and not $/sin x$ renders as \(sin x\).

Use subscripts to attach a notation to $\lim$, eg. $\lim_{x\to 0}$ renders as \(\lim_{x\to 0}\).

10. Some special symbols and notations

  1. $\lt$ \(\lt\) and $\not\lt$ \(\not\lt\)
  2. $\gt$ \(\gt\) and $\not\gt$ \(\not\gt\)
  3. $\le$ \(\le\) and $\not\le$ \(\not\le\)
  4. $\ge$ \(\ge\) and $\not\ge$ \(\not\ge\)
  5. $\times$ \(\times\) and $\div$ \(\div\)
  6. $\pm$ \(\pm\) and $\mp$ \(\mp\)
  7. $\ell \(\ell\)
  8. $\cdot$ \(\cdot\) and $\cup$ \(\cup\) and $\cap$ \(\cap\)
  9. $\setminus$ \(\setminus\)
  10. $\subset$ \(\subset\) and $\subseteq$ \(\subseteq\) and $\subsetneq$ \(\subsetneq\) and $\supset$ \(\supset\)
  11. $\in$ \(\in\) and $\notin$ \(\notin\)
  12. $\emptyset$ \(\emptyset\) and $\varnothing$ \(\varnothing\)
  13. ${n+1 \choose 2k}$ or $${n+1 \choose 2k}$ or $\binom{n+1}{2k}$ \(n+1 \choose 2k\)
  14. $\to$ \(\to\) or $\rightarrow$ \(\rightarrow\) or $\leftarrow$ \(\leftarrow\) or $\Rightarrow$ \(\Rightarrow\) or $\Leftarrow$ \(\Leftarrow\) or $\mapsto$ \(\mapsto\)
  15. $\land$ \(\land\) or $\lor$ \(\lor\) or $\lnot$ \(\lnot\) or $\forall$ \(\forall\) or $\exists$ \(\exists\) or $\top$ \(\top\) or $\bot$ \(\bot\) or $\vdash$ \(\vdash\) or $\vDash$ \(\vDash\)
  16. $\star$ \(\star\) or $\ast$ \(\ast\) or $\oplus$ \(\oplus\) or $\circ$ \(\circ\) or $\bullet$ \(\bullet\)
  17. $\approx$ \(\approx\) or $\sim$ \(\sim\) or $\simeq$ \(\simeq\) or $\cong$ \(\cong\) or $\equiv$ \(equiv\) or $\prec$ \(\prec\) or $\lhd$ \(\lhd\)
  18. $\infty$ \(\infty\) and $\aleph_0$ \(\aleph_0\) or $\nabla$ \(\nabla\) and $\partial$ \(\partial\) or $\Im$ \(\Im\) or $\Re$ \(\Re\)
  19. $\pmod$ for modular equivalence eg. $a\equiv b\pmod n$$ would render as \(a\equiv b\pmod n\)
  20. $\ldots is the dots in $a1,a2,\ldots,an$ renders as \(a1,a2,\ldots,an\) and $\cdots$ is the dots in $a1+a2+⋯+ana1+a2+⋯+an$ renders as \(a1+a2+\cdots+ana1+a2+\cdots+an\)
  21. $\epsilon$ renders as \(\epsilon\) and $\varepsilon$ renders as \(\varepsilon\)
  22. $\phi$ renders as \(\phi\) and $\varphi$ renders as \(\varphi\)

11. Spaces

$a_b$ and $a____b$ are both \(ab\).
  1. $\,$ renders as \(a\,b\)
  2. $\;$ renders as \(a\;b\)
  3. $\quad$ renders as \(a \quad b\)
  4. $\qquad$ renders as \(a \qquad b\)
12. Examples
  1. $sum_(i=1)^n i^3=((n(n+1))/2)^2$
    renders as
    \(sum_(i=1)^n i^3=((n(n+1))/2)^2\)
  2. $\begin{align}
    \sqrt{37}
    & = \sqrt{\frac{73^2-1}{12^2}} \\
    & = \sqrt{\frac{73^2}{12^2}\cdot\frac{73^2-1}{73^2}} \\
    & = \sqrt{\frac{73^2}{12^2}}\sqrt{\frac{73^2-1}{73^2}} \\
    & = \frac{73}{12}\sqrt{1 - \frac{1}{73^2}} \\
    & \approx \frac{73}{12}\left(1 - \frac{1}{2\cdot73^2}\right)
    \end{align}$

    renders as
    \(\begin{align} \sqrt{37} & = \sqrt{\frac{73^2-1}{12^2}} \\ & = \sqrt{\frac{73^2}{12^2}\cdot\frac{73^2-1}{73^2}} \\ & = \sqrt{\frac{73^2}{12^2}}\sqrt{\frac{73^2-1}{73^2}} \\ & = \frac{73}{12}\sqrt{1 - \frac{1}{73^2}} \\ & \approx \frac{73}{12}\left(1 - \frac{1}{2\cdot73^2}\right) \end{align} \)
  3. $P(Z\le z) = \Phi(z) = \int_{-\infty}^z \frac{1}{\sqrt{2\pi}} e^{-w^2/2}\,dw$ renders as \(P(Z\le z) = \Phi(z) = \int_{-\infty}^z \frac{1}{\sqrt{2\pi}} e^{-w^2/2}\,dw\)
  4. $\begin{align} \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\ \nabla \cdot \vec{\mathbf{B}} & = 0 \end{align}$ renders as \(\begin{align} \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\ \nabla \cdot \vec{\mathbf{B}} & = 0 \end{align}\)
13. Other references
  1. MathJAX - https://www.mathjax.org
  2. Calculatorium.com - http://www.calculatorium.com/mathjax-quick-start-tutorial/

Popular posts from this blog

Double Bunk in Caravan

With our family expanding, we faced a challenge of adding another berth in our caravan, but I did not want to make it permanent. A couple of options are available, of which one is simply to add a bunk to the single berth. We however did not want to cause any permanent markings on the interior of the caravan .

Netdata + SNMP + Mikrotik

Always wanted to see my Internet line usage as a gauge without having to log into the router. So today I configured SNMP in Netdata to collect from my Mikrotik router. /etc/netdata/node.d/snmp.conf: { "enable_autodetect": false, "update_every": 5, "max_request_size": 100, "servers": [ { "hostname": "10.1.1.1", "community": "public", "update_every": 5, "max_request_size": 50, "options": { "timeout": 20 }, "charts": { "mikrotik1.cpu": { "title": "CPU ", "units": "percentage", "type": "line", "family": "cpu", "dimensions": { "used&

CasparCG Simple Playlist

It is possible to build a simple playlist as a rundown in the CasparCG client. It will very simply play each item after each other that are on the same layer. In this very simple post I show how to build such a playlist including the very important step of activating the OSC. The Open Sound Control (OSC) implementation is how the client knows what the server is doing and then being able to send new command back to the server when a piece of media has ended to trigger playback of the next piece. For more details on the OCS, please see  http://casparcg.com/wiki/CasparCG_OSC_Protocol