Skip to content

Latest commit

 

History

History
141 lines (123 loc) · 3.27 KB

examples.md

File metadata and controls

141 lines (123 loc) · 3.27 KB

Examples

You can write math in 2 ways: inline and code block. Inline refers to using delimiters: $$ latex here $$ and ~ asciimath here ~, or any custom delimiters. Code block style refers to using tagged markdown code blocks. The tags can be either latex or asciimath. Because code block style is more limited, displayMode will be the displayMode passed to the extension config or the katex default.

Inline

Lorem ipsum dolor sit amet, ~E=mc^2~ consectetur adipiscing elit. Pellentesque porttitor, mauris a luctus aliquam, tellus purus porta nulla, eget finibus dolor dolor nec justo.
Lorem ipsum dolor sit amet, ~E=mc^2~ consectetur adipiscing elit. Pellentesque porttitor, mauris a luctus aliquam, tellus purus porta nulla, eget finibus dolor dolor nec justo.

Code Block

```asciimath E=mc^2 ```
```asciimath E=mc^2 ```

square roots

```asciimath c = +- sqrt(a^2 + b^2) ```
```asciimath c = +- sqrt(a^2 + b^2) ```
```latex c = \pm\sqrt{a^2 + b^2} ```
```latex c = \pm\sqrt{a^2 + b^2} ```

sumations

```asciimath sum_(i=1)^n i^3=((n(n+1))/2)^2 ```
```asciimath sum_(i=1)^n i^3=((n(n+1))/2)^2 ```
```latex \sum_{i=1}^n i^3 = \left( \frac{n(n+1)} 2 \right) ^2 ```
```latex \sum_{i=1}^n i^3 = \left( \frac{n(n+1)} 2 \right) ^2 ```

simple functions

```asciimath lim_(x->0) = f(x)' = 2x + 5 ```
```asciimath lim_(x->0) = f(x)' = 2x + 5 ```
```latex \lim_{x \to{0}} = f(x)' = 2x + 5 ```
```latex \lim_{x \to{0}} = f(x)' = 2x + 5 ```

more complex math

```latex \begin{aligned} F(\textbf{w}) &= \sum_{k=1}^{K} \frac{n_k}{N} F_{k}(\textbf{w}) \\ &= \sum_{k=1}^{K} \frac{n_k}{N} \frac{1}{n_k} \sum_{i \in \mathcal{P}_{k}} l(\textbf{x}_{i}, \textbf{y}_{i}; \textbf{w}) \end{aligned} ```
```latex \begin{aligned} F(\textbf{w}) &= \sum_{k=1}^{K} \frac{n_k}{N} F_{k}(\textbf{w}) \\ &= \sum_{k=1}^{K} \frac{n_k}{N} \frac{1}{n_k} \sum_{i \in \mathcal{P}_{k}} l(\textbf{x}_{i}, \textbf{y}_{i}; \textbf{w}) \end{aligned} ```