With Snow Flower Text’s lightweight markup, mathematical expressions can be easily represented in either of the two textual notations, LatexMath or AsciiMath. The formula layout is publication-quality based on Donald Knuth’s TeX, which is the standard for typesetting academic papers.
The mathematical expression of Snow Flower Text has the following features.
- HiDPI Support
Mathematical representations are handled in vector format. It renders vividly no matter what size you zoom in or out. This feature is inherited not only in the preview, but also in the exported PDF, HTML and EPUB.
- Free choice of AsciiDoc and MarkDown lightweight markup
Snow Flower Text is designed to minimize the differences in lightweight markup as much as possible, and uses the same math processor as AsciiDoc and MarkDown. AsciiDoc and MarkDown use a common math processor, so you can choose a lightweight markup format without worrying about the differences in LatexMath support of math processors.
1. How to use
1.1. How to use LatexMath
The way LatexMath displays formulas can be divided into two main modes: inline and display. In inline mode, formulas are embedded as inline elements and treated as part of the text. In display mode, the equation is centered as a block element with line breaks before and after the equation.
1.1.1. Inline elements mode
- How to write in AsciiDoc
Use the
latexmath:[]
inline macro.This is an inline equation: latexmath:[e=mc^2].
- How to write in Markdown
Enclose in
\\( … \\)
.This is an inline equation: \\( e=mc^2 \\)
The above code will be rendered as follows
This is an inline equation: \(e=mc^2\).
1.1.2. Block elements mode
- How to write in AsciiDoc
Use the
[latexmath]
block macro.[latexmath]
++++
x = \frac{-b \pm \sqrt{ b^2-4ac }}{2a}
++++- How to write in Markdown
Enclose in
$$ … $$
.$$ x = \frac{-b \pm \sqrt{ b^2-4ac }}{2a} $$
The above code will be rendered as follows
1.2. How to use AsciiMath
Most AsciiMath symbols are textual mimics of their appearance. Compared to LatexMath, they are less expressive, but more simple.
1.2.1. Inline elements mode
- How to write in AsciiDoc
Use the
asciimath:[]
inline macro.asciimath:[x=(-b +- sqrt(b^2 – 4ac))/(2a)]
- How to write in Markdown
Enclose in
\\$ … \\$
.\\$ x=(-b +- sqrt(b^2 – 4ac))/(2a) \\$
The above code will be rendered as follows
\$x=(-b +- sqrt(b^2 – 4ac))/(2a)\$
1.2.2. Block elements mode
- How to write in AsciiDoc
Use the
[asciimath]
block macro.[asciimath]
++++
x=(-b +- sqrt(b^2 – 4ac))/(2a)
++++
The above code will be rendered as follows
\$x=(-b +- sqrt(b^2 – 4ac))/(2a)\$
2. LatexMath
2.1. Symbols
Code | Display |
---|---|
| \(+\) |
| \(-\) |
| \(\pm\) |
| \(\times \) |
| \(\div \) |
| \(\setminus \) |
| \(\ast \) |
| \(\star \) |
| \(\cap \) |
| \(\bigcap \) |
| \(\cup \) |
| \(\bigcup \) |
| \(\sum \) |
| \(\prod \) |
| \(\coprod \) |
| \(\int \) |
| \(\iint \) |
| \(\iiint \) |
| \(\oint \) |
| \(\intop \) |
| \(\smallint \) |
| \(\wedge \) |
| \(\bigwedge \) |
| \(\vee \) |
| \(\bigvee \) |
| \(\sqcup \) |
| \(\bigsqcup \) |
| \(\otimes\) |
| \(\bigotimes\) |
| \(\oplus \) |
| \(\bigoplus \) |
| \(\odot \) |
| \(\bigodot \) |
| \(\uplus \) |
| \(\biguplus \) |
Code | Display |
---|---|
vfrac{2}{3} | \(\frac{2}{3}\) |
2^3 | \(2^3\) |
\sqrt x | \(\sqrt x\) |
\sqrt[3] x | \(\sqrt[3] x\) |
Code | Display |
---|---|
| \(= \) |
| \(\ne \) |
| \(< \) |
| \(> \) |
| \(\le \) |
| \(\ge \) |
| \(\prec \) |
| \(\preceq \) |
| \(\succ \) |
| \(\succeq \) |
| \(\ll \) |
| \(\gg \) |
| \(\leqslant \) |
| \(\geqslant \) |
| \(\leqq \) |
| \(\geqq \) |
| \(\in \) |
| \(\notin \) |
| \(\subset \) |
| \(\supset \) |
| \(\subseteq \) |
| \(\supseteq \) |
| \(\equiv \) |
| \(\cong \) |
| \(\approx \) |
| \(\propto \) |
Code | Display |
---|---|
| \(\neg \) |
| \(\implies \) |
| \(\iff \) |
| \(\forall \) |
| \(\exists \) |
| \(\bot \) |
| \(\top \) |
| \(\vdash \) |
| \(\models \) |
Code | Display |
---|---|
| \(( \) |
| \() \) |
| \([ \) |
| \(] \) |
| \(\{ \) |
| \(\} \) |
| \(\langle \) |
| \(\rangle \) |
| \(|x| \) |
Code | Display |
---|---|
| \(\Downarrow \) |
| \(\Downarrow \) |
| \(\downarrow \) |
| \(\gets \) |
| \(\hookleftarrow \) |
| \(\hookrightarrow \) |
| \(\leadsto \) |
| \(\Leftarrow \) |
| \(\leftarrow \) |
| \(\leftharpoondown\) |
| \(\leftharpoonup \) |
| \(\Leftrightarrow \) |
| \(\leftrightarrow \) |
| \(\Longleftarrow \) |
| \(\longleftarrow \) |
| \(\Longleftrightarrow \) |
| \(\longleftrightarrow \) |
| \(\longmapsto \) |
| \(\Longrightarrow \) |
| \(\longrightarrow \) |
| \(\mapsto \) |
| \(\nearrow \) |
| \(\nwarrow \) |
| \(\Rightarrow \) |
| \(\rightarrow \) |
| \(\rightharpoondown \) |
| \(\rightharpoonup \) |
| \(\rightleftharpoons\) |
| \(\searrow \) |
| \(\swarrow \) |
| \(\to \) |
| \(\Uparrow \) |
| \(\uparrow \) |
| \(\Updownarrow \) |
| \(\updownarrow \) |
Code | Display |
---|---|
| \(a’\) |
| \(a”\) |
| \(a^{\prime}\) |
| \(\acute{a}\) |
| \(\bar{y}\) |
| \(\breve{a}\) |
| \(\check{a}\) |
| \(\dot{a}\) |
| \(\ddot{a}\) |
| \(\grave{a}\) |
| \(\hat{\theta}\) |
| \(\widehat{ac}\) |
| \(\tilde{a}\) |
| \(\widetilde{ac}\) |
| \(\vec{F}\) |
| \(\overline{AB}\) |
| \(\underline{AB}\) |
| \(\overleftarrow{AB}\) |
| \(\underleftarrow{AB}\) |
| \(\overleftrightarrow{AB}\) |
| \(\underleftrightarrow{AB}\) |
| \(\overrightarrow{AB}\) |
| \(\underrightarrow{AB}\) |
| \(\overbrace{AB}\) |
| \(\underbrace{AB}\) |
Code | Display |
---|---|
| \(\alpha\) |
| \(\beta\) |
| \(\gamma\) |
| \(\Gamma\) |
| \(\delta\) |
| \(\Delta\) |
| \(\epsilon\) |
| \(\varepsilon\) |
| \(\zeta\) |
| \(\eta\) |
| \(\theta\) |
| \(\vartheta\) |
| \(\Theta\) |
| \(\iota\) |
| \(\kappa\) |
| \(\lambda\) |
| \(\Lambda\) |
| \(\mu\) |
| \(\nu\) |
| \(\xi\) |
| \(\Xi\) |
| \(\omicron\) |
| \(\pi\) |
| \(\Pi\) |
| \(\rho\) |
| \(\sigma\) |
| \(\Sigma\) |
| \(\tau\) |
| \(\upsilon\) |
| \(\phi\) |
| \(\Phi\) |
| \(\varphi\) |
| \(\chi\) |
| \(\psi\) |
| \(\omega\) |
| \(\Omega\) |
2.2. Font
2.2.1. Font family
LatexMath uses italics by default. For example, if you are writing element symbols or units, it is better to change the font with the \mathrm
command.
[latexmath]
++++
\mathrm{H_2+\frac{1}{2}O_2 = H_2O(l)+268kJ}
++++
\mathrm
command Code | Display | Description |
---|---|---|
| \(\mathrm{ABCDEF\ abcdef\ 123456}\) | Serif |
| \(\mathbf{ABCDEF\ abcdef\ 123456}\) | Bold font |
| \(\mathit{ABCDEF\ abcdef\ 123456}\) | Italic font |
| \(\mathsf{ABCDEF\ abcdef\ 123456}\) | Sans-serif |
| \(\mathtt{ABCDEF\ abcdef\ 123456}\) | Monospace |
| \(\textrm{ABCDEF abcdef 123456}\) | |
| \(\textbf{ABCDEF abcdef 123456}\) | |
| \(\textit{ABCDEF abcdef 123456}\) | |
| \(\textsf{ABCDEF abcdef 123456}\) | |
| \(\texttt{ABCDEF abcdef 123456}\) | |
| \(\rm{ABCDEF}\) | |
| \(\bf{ABCDEF}\) | |
| \(\it{ABCDEF}\) | |
| \(\sf{ABCDEF}\) | |
| \(\tt{ABCDEF\ abcdef\ 123456}\) | |
| \(\Bbb{ABCDEF}\) | |
| \(\mathcal{ABCDEF}\) | Calligraphy |
| \(\frak{ABCDEF\ abcdef\ 123456}\) | Fraktur |
| \(\boldsymbol{ABCDEF}\) | |
| \(\mathbb{ABCDEF}\) | Blackboard bold |
| \(\mathscr{ABCDEF}\) | Script |
| \(\mathfrak{ABCDEF\ abcdef\ 123456}\) | Fraktur |
2.2.2. Font size
[latexmath]
++++
\Huge Lorem Ipsum
++++
The above code will be rendered as follows
Code | Display |
---|---|
| \(\Huge{Lorem\ Ipsum}\) |
| \(\huge{Lorem\ Ipsum}\) |
| \(\LARGE{Lorem\ Ipsum}\) |
| \(\Large{Lorem\ Ipsum}\) |
| \(\Large{Lorem\ Ipsum}\) |
| \(\normalsize{Lorem\ Ipsum}\) |
| \(\small{Lorem\ Ipsum}\) |
| \(\scriptsize{Lorem\ Ipsum}\) |
| \(\tiny{Lorem\ Ipsum}\) |
2.3. Layout
2.3.1. Align the height of the parentheses
The \left
and \right
commands can be used to automatically adjust the height of the parentheses if you want the parentheses to be automatically enlarged and adjusted to fit the mathematical expression in the parentheses.
For example, if the expression in parentheses is a fraction, the height of the parentheses will be insufficient.
\begin{align}
[\frac{3}{5} ] \\
(\frac{3}{5} ) \\
\{\frac{x+1}{y^2}\}
\end{align}
The \left
and \right
commands are used to adjust the height.
\begin{align}
\left[ \frac{3}{5} \right] \\
\left( \frac{3}{5} \right) \\
\left\{\frac{x+1}{y^2}\right\}
\end{align}
2.3.2. Aligning the height of modifiers
The \mathstrut
command will align the height of the modifier symbols.
In the following example, the height of the root symbol varies depending on the height of the character.
\sqrt{a} + \sqrt{b} + \sqrt{c} + \sqrt{d}
By using the \mathstrut
command, the height of the parentheses will be aligned as follows
\sqrt{\mathstrut a} + \sqrt{\mathstrut b} + \sqrt{\mathstrut c} + \sqrt{\mathstrut d}
2.3.3. Align the text start position
f(n) = \left\{
\begin{array}{l l}
n/2 \quad \text{if $n$ is even}\\
-(n+1)/2 \quad \text{if $n$ is odd}\\
\end{array}
\right.
f(n) = \left\{
\begin{array}{l l}
n/2 & \quad \text{if $n$ is even}\\
-(n+1)/2 & \quad \text{if $n$ is odd}\\
\end{array}
\right.
This will align the text start position.
2.3.4. Change to block mode while in inline mode
\sum_{k=1}^{n}k^2
\(\sum_{k=1}^{n}k^2\)
\displaystyle \sum_{k=1}^{n}k^2
\(\displaystyle \sum_{k=1}^{n}k^2\)
2.3.5. Label equation with a symbols
Use \tag{label}
to add an equation number to the equation, where label can be any character.
\frac{3}{5} \tag{5}
Use \tag*{label}
if parentheses are not needed.
\frac{3}{5} \tag*{5}
3. LatexMath Sample
\begin{align}
\dot{x} & = \sigma(y-x) \\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{align}
\left( \sum_{k=1}^n a_k b_k \right)^{\!\!2} \leq
\left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
\mathbf{V}_1 \times \mathbf{V}_2 =
\begin{vmatrix}
\mathbf{i} & \mathbf{j} & \mathbf{k} \\
\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\
\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 \\
\end{vmatrix}
1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots =
\prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})},
\quad\quad \text{for $|q|<1$}.
\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} =
1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}}
{1+\frac{e^{-8\pi}} {1+\ldots} } } }
4. AsciiMath Sample
x=(-b +- sqrt(b^2 – 4ac))/(2a)