195 lines
10 KiB
Text
195 lines
10 KiB
Text
|
||
Simple inline math
|
||
.
|
||
$1+1 = 2$
|
||
.
|
||
<p><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>+</mo><mn>1</mn><mo>=</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">1+1 = 2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.64444em;"></span><span class="strut bottom" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="base textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord mathrm">1</span><span class="mrel">=</span><span class="mord mathrm">2</span></span></span></span></p>
|
||
.
|
||
|
||
Simple block math
|
||
.
|
||
$$1+1 = 2$$
|
||
.
|
||
<span class="katex-display"><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>+</mo><mn>1</mn><mo>=</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">1+1 = 2
|
||
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.64444em;"></span><span class="strut bottom" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="base displaystyle textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord mathrm">1</span><span class="mrel">=</span><span class="mord mathrm">2</span></span></span></span></span>
|
||
.
|
||
|
||
No whitespace before and after is fine
|
||
.
|
||
foo$1+1 = 2$bar
|
||
.
|
||
<p>foo<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>+</mo><mn>1</mn><mo>=</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">1+1 = 2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.64444em;"></span><span class="strut bottom" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="base textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord mathrm">1</span><span class="mrel">=</span><span class="mord mathrm">2</span></span></span></span>bar</p>
|
||
.
|
||
|
||
Even when it starts with a negative sign
|
||
.
|
||
foo$-1+1 = 2$bar
|
||
.
|
||
<p>foo<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mo>−</mo><mn>1</mn><mo>+</mo><mn>1</mn><mo>=</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">-1+1 = 2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.64444em;"></span><span class="strut bottom" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="base textstyle uncramped"><span class="mord">−</span><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord mathrm">1</span><span class="mrel">=</span><span class="mord mathrm">2</span></span></span></span>bar</p>
|
||
.
|
||
|
||
Shouldn't render empty content
|
||
.
|
||
aaa $$ bbb
|
||
.
|
||
<p>aaa $$ bbb</p>
|
||
.
|
||
|
||
Shouldn't render USD
|
||
.
|
||
aaa $5.99 bbb
|
||
.
|
||
<p>aaa $5.99 bbb</p>
|
||
.
|
||
|
||
Shouldn't render trailing delimiter
|
||
.
|
||
aaa 5.99$ bbb
|
||
.
|
||
<p>aaa 5.99$ bbb</p>
|
||
.
|
||
|
||
Paragraph break in inline math is not allowed
|
||
.
|
||
foo $1+1
|
||
|
||
= 2$ bar
|
||
.
|
||
<p>foo $1+1</p>
|
||
<p>= 2$ bar</p>
|
||
.
|
||
|
||
Neither is an end of document
|
||
.
|
||
foo $1+1 = 2
|
||
.
|
||
<p>foo $1+1 = 2</p>
|
||
.
|
||
|
||
Inline math with apparent markup
|
||
.
|
||
foo $1 *i* 1$ bar
|
||
.
|
||
<p>foo <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>∗</mo><mi>i</mi><mo>∗</mo><mn>1</mn></mrow><annotation encoding="application/x-tex">1 *i* 1</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.65952em;"></span><span class="strut bottom" style="height:0.65952em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">∗</span><span class="mord mathit">i</span><span class="mbin">∗</span><span class="mord mathrm">1</span></span></span></span> bar</p>
|
||
.
|
||
|
||
Block math can be indented up to 3 spaces
|
||
.
|
||
$$
|
||
1+1 = 2
|
||
$$
|
||
.
|
||
<span class="katex-display"><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>+</mo><mn>1</mn><mo>=</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">1+1 = 2
|
||
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.64444em;"></span><span class="strut bottom" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="base displaystyle textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord mathrm">1</span><span class="mrel">=</span><span class="mord mathrm">2</span></span></span></span></span>
|
||
.
|
||
|
||
But 4 means a code block
|
||
.
|
||
$$
|
||
1+1 = 2
|
||
$$
|
||
.
|
||
<pre><code>$$
|
||
1+1 = 2
|
||
$$
|
||
</code></pre>
|
||
.
|
||
|
||
|
||
Multiline inline math
|
||
.
|
||
foo $1 + 1
|
||
= 2$ bar
|
||
.
|
||
<p>foo <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>+</mo><mn>1</mn><mo>=</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">1 + 1
|
||
= 2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.64444em;"></span><span class="strut bottom" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="base textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord mathrm">1</span><span class="mrel">=</span><span class="mord mathrm">2</span></span></span></span> bar</p>
|
||
.
|
||
|
||
|
||
Multiline display math
|
||
.
|
||
$$
|
||
|
||
1
|
||
+ 1
|
||
|
||
= 2
|
||
|
||
$$
|
||
.
|
||
<span class="katex-display"><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>+</mo><mn>1</mn><mo>=</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">
|
||
1
|
||
+ 1
|
||
|
||
= 2
|
||
|
||
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.64444em;"></span><span class="strut bottom" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="base displaystyle textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord mathrm">1</span><span class="mrel">=</span><span class="mord mathrm">2</span></span></span></span></span>
|
||
.
|
||
|
||
Text can immediately follow inline math
|
||
.
|
||
$n$-th order
|
||
.
|
||
<p><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.43056em;"></span><span class="strut bottom" style="height:0.43056em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit">n</span></span></span></span>-th order</p>
|
||
.
|
||
|
||
|
||
Display math self-closes at the end of document
|
||
.
|
||
$$
|
||
1+1 = 2
|
||
.
|
||
<span class="katex-display"><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>+</mo><mn>1</mn><mo>=</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">1+1 = 2
|
||
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.64444em;"></span><span class="strut bottom" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="base displaystyle textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord mathrm">1</span><span class="mrel">=</span><span class="mord mathrm">2</span></span></span></span></span>
|
||
.
|
||
|
||
|
||
Display and inline math can appear in lists
|
||
.
|
||
* $1+1 = 2$
|
||
* $$
|
||
1+1 = 2
|
||
$$
|
||
.
|
||
<ul>
|
||
<li><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>+</mo><mn>1</mn><mo>=</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">1+1 = 2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.64444em;"></span><span class="strut bottom" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="base textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord mathrm">1</span><span class="mrel">=</span><span class="mord mathrm">2</span></span></span></span></li>
|
||
<li>
|
||
<span class="katex-display"><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>+</mo><mn>1</mn><mo>=</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">1+1 = 2
|
||
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.64444em;"></span><span class="strut bottom" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="base displaystyle textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord mathrm">1</span><span class="mrel">=</span><span class="mord mathrm">2</span></span></span></span></span>
|
||
</li>
|
||
</ul>
|
||
.
|
||
|
||
Display math can be written in one line
|
||
.
|
||
$$1+1 = 2$$
|
||
.
|
||
<span class="katex-display"><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>+</mo><mn>1</mn><mo>=</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">1+1 = 2
|
||
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.64444em;"></span><span class="strut bottom" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="base displaystyle textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord mathrm">1</span><span class="mrel">=</span><span class="mord mathrm">2</span></span></span></span></span>
|
||
.
|
||
|
||
Or on multiple lines with expression starting and ending on delimited lines
|
||
.
|
||
$$[
|
||
[1, 2]
|
||
[3, 4]
|
||
]$$
|
||
.
|
||
<span class="katex-display"><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mo>[</mo><mo>[</mo><mn>1</mn><mo separator="true">,</mo><mn>2</mn><mo>]</mo><mo>[</mo><mn>3</mn><mo separator="true">,</mo><mn>4</mn><mo>]</mo><mo>]</mo></mrow><annotation encoding="application/x-tex">[
|
||
[1, 2]
|
||
[3, 4]
|
||
]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.75em;"></span><span class="strut bottom" style="height:1em;vertical-align:-0.25em;"></span><span class="base displaystyle textstyle uncramped"><span class="mopen">[</span><span class="mopen">[</span><span class="mord mathrm">1</span><span class="mpunct">,</span><span class="mord mathrm">2</span><span class="mclose">]</span><span class="mopen">[</span><span class="mord mathrm">3</span><span class="mpunct">,</span><span class="mord mathrm">4</span><span class="mclose">]</span><span class="mclose">]</span></span></span></span></span>
|
||
.
|
||
|
||
Escaped delimiters should not render math
|
||
.
|
||
Foo \$1$ bar
|
||
\$\$
|
||
1
|
||
\$\$
|
||
.
|
||
<p>Foo $1$ bar
|
||
$$
|
||
1
|
||
$$</p>
|
||
.
|