| 1 |
--- |
| 2 |
title: Code Math |
| 3 |
version: 0.1 |
| 4 |
date: '2024-03-22' |
| 5 |
license: '[CC-BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)' |
| 6 |
based_on: https://docs.gitlab.com/ee/user/markdown.html#math |
| 7 |
--- |
| 8 |
|
| 9 |
# TeX Math |
| 10 |
|
| 11 |
Inline math goes between `` $` `` characters, and display math |
| 12 |
use the code block ``` ```math ````: |
| 13 |
|
| 14 |
```````````````````````````````` example |
| 15 |
Let $`x`$ and $`y`$ be integers such that |
| 16 |
|
| 17 |
```math |
| 18 |
x=y + 2 |
| 19 |
``` |
| 20 |
. |
| 21 |
<p>Let <code data-math-style="inline">x</code> and <code data-math-style="inline">y</code> be integers such that</p> |
| 22 |
<pre><code class="language-math" data-math-style="display">x=y + 2 |
| 23 |
</code></pre> |
| 24 |
```````````````````````````````` |
| 25 |
|
| 26 |
|
| 27 |
In inline math, it behaves just like inline code. |
| 28 |
|
| 29 |
```````````````````````````````` example |
| 30 |
This is math:$`2000`$. |
| 31 |
. |
| 32 |
<p>This is math:<code data-math-style="inline">2000</code>.</p> |
| 33 |
```````````````````````````````` |
| 34 |
|
| 35 |
|
| 36 |
Note that math can contain embedded math. In scanning |
| 37 |
for a closing delimiter, we do not need to skip material in balanced |
| 38 |
curly braces: |
| 39 |
|
| 40 |
```````````````````````````````` example |
| 41 |
This is display math: |
| 42 |
|
| 43 |
```math |
| 44 |
\text{Hello $x^2$} |
| 45 |
``` |
| 46 |
And this is inline math: |
| 47 |
$`\text{Hello $x$ there!}`$ |
| 48 |
. |
| 49 |
<p>This is display math:</p> |
| 50 |
<pre><code class="language-math" data-math-style="display">\text{Hello $x^2$} |
| 51 |
</code></pre> |
| 52 |
<p>And this is inline math: |
| 53 |
<code data-math-style="inline">\text{Hello $x$ there!}</code></p> |
| 54 |
```````````````````````````````` |
| 55 |
|
| 56 |
|
| 57 |
Dollar signs not required to be backslashed. It may be |
| 58 |
required to render the math properly, but it's not required |
| 59 |
for parsing: |
| 60 |
|
| 61 |
```````````````````````````````` example |
| 62 |
$`\text{$}`$ |
| 63 |
. |
| 64 |
<p><code data-math-style="inline">\text{$}</code></p> |
| 65 |
```````````````````````````````` |
| 66 |
|
| 67 |
Everything inside the math construction is treated |
| 68 |
as math, and not given its normal commonmark meaning. |
| 69 |
|
| 70 |
```````````````````````````````` example |
| 71 |
$`b<a>c`$ |
| 72 |
. |
| 73 |
<p><code data-math-style="inline">b<a>c</code></p> |
| 74 |
```````````````````````````````` |
| 75 |
|
| 76 |
Double dollar signs are not supported |
| 77 |
|
| 78 |
```````````````````````````````` example |
| 79 |
$$`1 + 2`$$ |
| 80 |
. |
| 81 |
<p>$$<code>1 + 2</code>$$</p> |
| 82 |
```````````````````````````````` |