markdown

Docs:

https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions

Math:

https://latex.codecogs.com/

Math inside RMarkdown

https://rpruim.github.io/s341/S19/from-class/MathinRmd.html

Math inside RMarkdown

In side a text chunk, you can use mathematical notation if you surround it by dollar signs $ for “inline mathematics” and $$ for “displayed equations”. Do not leave a space between the $ and your mathematical notation.

Example: $\sum*{n=1}^{10} n^2$ is rendered as $\sum*{n=1}^{10} n^2$.

Example: $$\sum_{n=1}^{10} n^2$$ is rendered as: $$\sum_{n=1}^{10} n^2$$

Example:

$$ \gamma_{n} = \frac{ \left | \left (\mathbf x_{n} - \mathbf x_{n-1} \right )^T \left [\nabla F (\mathbf x_{n}) - \nabla F (\mathbf x_{n-1}) \right ] \right |}{\left \|\nabla F(\mathbf{x}_{n}) - \nabla F(\mathbf{x}_{n-1}) \right \|^2} $$

The mathematical typesetting is based on LaTeX, so if you need to search for the way to make a particular symbol, include latex in your search. But note: Not all LaTeX macros are available without using additional packages, and those packages likely will only work if you are creating a PDF. On the plus side, if you are working in PDF, you can use additional packages that give much better control and/or easier syntax.

In LaTeX,

  • macros begin with a backslash ()
  • curly braces ({ and }) are used to surround items that are to be considered as one object from LaTeX’s perspective. Without them, usually the next letter or digit will be used, but that isn’t usually what you want. For example $$\sum_x=1^10 x^2$$ produces $$\sum_x=1^10 x^2$$

Mathematical Notation

Here are some common mathematical things you might use in statistics

公式代码
$x<y$x < y
x>yx > y
x≤yx \le y
x≥yx \ge y
xnx^{n}
xnx_{n}
x¯¯¯\overline{x}
x^\hat{x}
x~\tilde{x}
ab\frac{a}{b}
∂f∂x\frac{\partial f}{\partial x}
∂f∂x\displaystyle \frac{\partial f}{\partial x}
(nk)\binom{n}{k}
x1+x2+⋯+xnx*{1} + x*{2} + \cdots + x_{n}
x1,x2,…,xnx*{1}, x*{2}, \dots, x_{n}
x=⟨x1,x2,…,xn⟩\mathbf{x} = \langle x*{1}, x*{2}, \dots, x*{n}\rangle (\bm from the bm pacakge would be better)
x∈Ax \in A
|A||A|
x∈Ax \in A
A⊂Bx \subset B
A⊆Bx \subseteq B
A∪BA \cup B
A∩BA \cap B
X∼Binom(n,π)X \sim {\sf Binom}(n, \pi) (sf for “slide font”)
P(X≤x)=pbinom(x,n,π)\mathrm{P}(X \le x) = {\tt pbinom}(x, n, \pi) (tt for “typewriter type”)
P(A∣B)P(A \mid B)
P(A∣B)\mathrm{P}(A \mid B) (mathrm for “math roman font”
{1,2,3}{1, 2, 3}
sin(x)\sin(x)
log(x)\log(x)
$\int_a^b$\int_a^b
$\left(\int_a^b f(x) dx \right)$\left(\int_a^b f(x) dx \right)
$\left[\int_{-\infty}^{\infty} f(x) ; dx\right]$\left[\int_{-\infty}^{\infty} f(x) ; dx\right]
$F(x) |_{a}^{b}$F(x) |_{a}^{b}
$\sum_{x = a}^{b} f(x)$\sum_{x = a}^{b} f(x)
$\prod_{x = a}^{b} f(x)$\prod_{x = a}^{b} f(x)
$\lim_{x \to \infty} f(x)$\lim_{x \to \infty} f(x)
$\displaystyle \lim_{x \to \infty} f(x)$\displaystyle \lim_{x \to \infty} f(x)

Greek Letters

Greek LetterMarkdown CodeGreek LetterMarkdown Code
αA$ \alpha A$νN$ \nu |N$
βB$ \beta B$ξΞ$ \xi\Xi$
γΓ$ \gamma \Gamma$oO$ o O$ (omicron)
δΔ$ \delta \Delta$πΠ$ \pi \Pi$
ϵεE$ \epsilon \varepsilon E$ρϱP $\rho\varrho P$
ζZ$ \zeta Z \sigma ,!$Σ$\sigma \Sigma$
ηH$ \eta H$τT$\tau T$
θϑΘ$ \theta \vartheta \Theta$υΥ$\upsilon \Upsilon$
ιI$ \iota I$ϕφΦ$\phi \varphi \Phi$
κK$ \kappa K$χX$\chi X$
λΛ$ \lambda \Lambda$ψΨ$ \psi \Psi$
μM$ \mu M$ωΩ$ \omega \Omega$

SymbolicLogic:

Mermaid: Link

Cheat sheet: The Ultimate Markdown Cheat Sheet

Diagrams: Draw Diagrams With Markdown

Previous
Next