UNPKG

2.19 kBMarkdownView Raw
1## Math Notation
2
3By using MathJax, we can display all sorts of notation.
4
5We can do inline math: $E = mc^2$
6
7Or we can do block math:
8
9$$
10A \longrightarrow B
11$$
12
13$$
14\begin{array}{c|lcr}
15n & \text{Left} & \text{Center} & \text{Right} \\
16\hline
171 & 0.24 & 1 & 125 \\
182 & -1 & 189 & -8 \\
193 & -20 & 2000 & 1+10i
20\end{array}
21$$
22
23And even diagrams via *xyjax*:
24
25$$
26\begin{xy}
270;<1em,0em>:
28(1,1);p+/v a(18) 5.5em/**@{-},
29(1,3);p+/v a(18) 5.5em/**@2{-},
30(1,5);p+/v a(18) 5.5em/**@3{-},
31(1,9);p+/v a(18) 5.5em/**@{.},
32(1,11);p+/v a(18) 5.5em/**@2{.},
33(1,13);p+/v a(18) 5.5em/**@3{..},
34\end{xy}
35$$
36
37
38
39$$
40\begin{xy}
41\xymatrix {
42U \ar@/_/[ddr]_y \ar@{.>}[dr]|{\langle x,y \rangle} \ar@/^/[drr]^x \\
43 & X \times_Z Y \ar[d]^q \ar[r]_p & X \ar[d]_f \\
44 & Y \ar[r]^g & Z
45}
46\end{xy}
47$$
48
49#### MathJax $\LaTeX$ vs AsciiMath Syntax
50
51Recently, I learned that MathJax had an alternative syntax, [AsciiMath](http://asciimath.org) that is simpler for many purposes. Smartdown has enabled this feature, although we are currently using `@` as the delimiter instead of \` or `$`.
52
53
54##### $\LaTeX$ Syntax
55
56Currently, Smartdown uses LaTeX-style math syntax, so the following formula:
57
58$$
59\sum_{i=1}^{n} i^3=\left(\frac{n(n+1)}{2}\right)^2
60$$
61
62is expressed as:
63
64```
65$$
66\sum_{i=1}^{n} i^3=\left(\frac{n(n+1)}{2}\right)^2
67$$
68```
69
70##### AsciiMath Syntax
71
72The above formula is expressed in AsciiMath (using `@` as delimiters) as:
73
74```
75@sum_(i=1)^n i^3=((n(n+1))/2)^2@
76```
77
78which Smartdown now renders as:
79
80@sum_(i=1)^n i^3=((n(n+1))/2)^2@
81
82Note that AsciiMath via MathJax does not support *display-mode* equations, but centering can be achieved via Markdown table syntax:
83
84||
85|:---:|
86|@sum_(i=1)^n i^3=((n(n+1))/2)^2@|
87
88
89##### More AsciiMath Examples
90
91|AsciiMath|Rendered|
92|:---:|:---:|
93|`@[[a,b],[c,d]]@`|@[[a,b],[c,d]]@|
94|`@sqrt sqrt root3x@`|@sqrt sqrt root3x@|
95|`@int_0^1 f(x)dx@`|@int_0^1 f(x)dx@|
96|`@hat(ab) bar(xy) ulA vec v dotx ddot y@`|@hat(ab) bar(xy) ulA vec v dotx ddot y@|
97
98---
99
100
101#### Chemistry via `mhchem`
102
103$$
104\ce{Zn^2+
105 <=>[+ 2OH-][+ 2H+]
106 $\underset{\text{amphoteres Hydroxid}}{\ce{Zn(OH)2 v}}$
107 <=>[+ 2OH-][+ 2H+]
108 $\underset{\text{Hydroxozikat}}{\ce{[Zn(OH)4]^2-}}$
109}
110$$
111
112---
113
114[Back to Home](:@Home)
115