Синтаксис Mathjax
Зразок математичного рівняння
$$x=(-b+-sqrt(b^2-4ac))/(2a)$$
$$x=(-b+-sqrt(b^2-4ac))/(2a)$$
Розділювачі
Для формул у тексті відділимо її $
…$
. Для відображення формули в окремому рядку використаємо $$
…$$
.
Формула $\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$
буде виглядати $\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$.
А так виглядатиме ця формула
$$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$
$$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$
Грецькі символи
Використовуємо \alpha
, \beta
, \omega
для $\alpha$, $\beta$, $\omega$. Для верхнього регістру, використовуємо \Gamma
, \Delta
, \Omega
для $\Gamma$, $\Delta$, $\Omega$. Для інших грецьких заголовних літер, використовуємо латинські A,B,EA, B, E, тощо. Деякі грецькі літери мають варіанти написання: \epsilon
, \varepsilon
$\epsilon$, $\varepsilon$.
Нижній і верхній індекси
Use ^
and _
. For example, x_i^2
for $x_i^2$, \log_2 x
for $log_2 x$.
Групи
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^{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 $xyz{x^y}^z$, and x^{y^z}
is $xyzx^{y^z}$. Observe the differences between x_i^2
$x_{i^2}$, xi2x_{i^2} and ${x_i}^2$.
Дужки
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$.
Суми та інтеграли
\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$, \idotsint
$\idotsint$.
Дроби
There are three 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}$. For continued fractions, use \cfrac instead of \frac.
Шрифти
- Use
\mathbb
or\Bbb
for “blackboard bold”: $\mathbb{CHNQRZ}$. - Use
\mathbf
for boldface
$\mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$$\mathbf{abcdefghijklmnopqrstuvwxyz}$ - For expression based characters, use
\boldsymbol
instead: $\boldsymbol{\alpha}$ - Use
\mathit
for italics: $\mathit{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$$\mathit{abcdefghijklmnopqrstuvwxyz}$ - Use
\pmb
for boldfaced italics: $\pmb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$$\pmb{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}$ (Uppercase only) - Use
\mathscr
for script letters: $\mathscr{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$$\mathscr{abcdefghijklmnopqrstuvwxyz}$ - Use
\mathfrak
for “Fraktur” (old German style) letters: $\mathfrak{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$$\mathfrak{abcdefghijklmnopqrstuvwxyz}$
Корені та степені
Use sqrt
, which adjusts to the size of its argument: \sqrt{x^3}
$\sqrt{x^3}$; \sqrt[3]{\frac xy}
$\sqrt[3]{\frac xy}$. For complicated expressions, consider using {...}^{1/2}
instead.
Спеціальні функції
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$, not sin x
$sin x$. Use subscripts to attach a notation to \lim
: \lim_{x\to 0}
$$\lim_{x\to 0}$$
Nonstandard function names can be set with \operatorname{foo}(x)
$\operatorname{foo}(x)$.
Спеціальні символи та позначення
There are a very large number of special symbols and notations, too many to list here; see the exhaustive listing The Comprehensive LATEX. Some of the most common include
\lt \gt \le \leq \leqq \leqslant \ge \geq \geqq \geqslant \neq
$\lt$, $\gt$, $\le$, $\leq$, $\leqq$, $\leqslant$, $\ge$, $\geq$, $\geqq$, $\geqslant$, $\neq$. You can use\not
to put a slash through almost anything:\not\lt
$\not\lt$ but it often looks bad.\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 \gets \rightarrow \leftarrow \Rightarrow \Leftarrow \mapsto \implies \iff
$\to$, $\gets$, $\rightarrow$, $\leftarrow$, $\Rightarrow$, $\Leftarrow$, $\mapsto$, $\implies$, $\iff$.\land \lor \lnot \forall \exists \top \bot \vdash \vDash
$\land$, $\lor$, $\lnot$, $\forall$, $\exists$, $\top$, $\bot$, $\vdash$, $\vDash$.\star \circledast \ast \oplus \circ \bullet
$\star$, $\circledast$, $\ast$, $\oplus$, $\circ$, $\bullet$.
Пробіли
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
and a␣␣␣␣b
are both $ab$. 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 set plain text, use \text{…}
: ${x\in s\mid x\text{ is extra large}}$. You can nest $…$
inside of \text{…}
, for example to access spaces.
Діакритичні позначки
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
.
Спеціальні символи
Used for MathJax interpreting can be escaped using the \
character: \$ $
\$, \{
{\{, \}
}\}, \_
_\_, \#
#\#, \&
&\&. If you want \
itself, you should use \backslash
(symbol) or \setminus
(binary operation) for ∖\backslash, because \\
is for a new line.