前言

最近开始使用起markdown来记学习笔记,因为经常有公式要写,就需要用到latex,到网上查来查去又不太方便,而且也很少能查到写的比较全的,就准备写下这篇文章。

插入数学公式

在markdown中插入数学公式的语法有两种:

  1. 行内公式$数学公式$
  2. 行间公式$$数学公式$$

如:

  1. 函数$ L(Y,f(X))=(Y-f(X))^2 $
  2. 函数
  3. $$
  4. L(Y,f(X))=(Y-f(X))^2
  5. $$

函数$ L(Y,f(X))=(Y-f(X))^2 ​$

函数

\[L(Y,f(X))=(Y-f(X))^2
\]

如果需要加编号,加上\tag{编号}即可,如:

  1. $$
  2. L(Y,f(X))=(Y-f(X))^2
  3. \tag{1}
  4. $$

\[L(Y,f(X))=(Y-f(X))^2
\tag{1}
\]

上下标

上标可由^表示,下标可由_表示,若上下标不止一个字符则需用花括号{}括起

如:

  1. n_x n^x

\(n_x\) \(n^x\)

分数

分数输入格式为\frac{分子}{分母}

如:

  1. $\frac{1}{N}$

\(\frac{1}{N}\)

括号

() []|都表示自己,但是{}需加\

如:

  1. $() [] | \{\}$

\(() [] | \{\}\)

上下划线

  1. $$
  2. \begin{array}
  3. \overline{a+b} \\
  4. \underline{a+b} \\
  5. \overleftarrow{a+b} \\
  6. \underleftarrow{a+b} \\
  7. \underleftrightarrow{a+b} \\
  8. \vec x = \vec{AB} \\
  9. \overbrace {a+b}^\text{a,b} \\
  10. a+\rlap{\overbrace{\phantom{b+c+d}}^m}b+\underbrace{c+d+e}_n+f
  11. \end{array}
  12. $$

\[\begin{array}
\overline{a+b} \\
\underline{a+b} \\
\overleftarrow{a+b} \\
\underleftarrow{a+b} \\
\underleftrightarrow{a+b} \\
\vec x = \vec{AB} \\
\overbrace {a+b}^\text{a,b} \\
a+\rlap{\overbrace{\phantom{b+c+d}}^m}b+\underbrace{c+d+e}_n+f
\end{array}
\]

省略号

  1. $$
  2. \begin{eqnarray*} \\
  3. \ldots \\
  4. \cdots \\
  5. \vdots \\
  6. \ddots \\
  7. \end{eqnarray*}
  8. $$

\[\begin{eqnarray*} \\
\ldots \\
\cdots \\
\vdots \\
\ddots \\
\end{eqnarray*}
\]

线性方程组

使用case环境将多个公式组合

  1. $$
  2. L(Y,f(X))=
  3. \begin{cases}
  4. 1,\quad &Y\neq f(X)\\
  5. 0,\quad &Y=f(X)
  6. \end{cases}
  7. $$

\[L(Y,f(X))=
\begin{cases}
1,\quad &Y\neq f(X)\\
0,\quad &Y=f(X)
\end{cases}
\]

另还有gathered环境

  1. $$
  2. \left. \begin{gathered}
  3. S \subseteq T \\
  4. S \supseteq T
  5. \end{gathered} \right\}
  6. \implies S = T
  7. $$

\[\left. \begin{gathered}
A \subseteq B \\
A \supseteq B
\end{gathered} \right\}
\implies A = B
\]

数学模式重音符

  1. $$
  2. \hat{a} \check{a} \tilde{a} \acute{a}
  3. \grave{a} \dot{a} \ddot{a} \breve{a}
  4. \bar{a} \vec{a} \widehat{a} \widetilde{a}
  5. $$

\[\hat{a} \check{a} \tilde{a} \acute{a}\\
\grave{a} \dot{a} \ddot{a} \breve{a}\\
\bar{a} \vec{a} \widehat{a} \widetilde{a}
\]

矩阵

  1. $$
  2. X =
  3. \left[
  4. \begin{matrix}
  5. x^{(1)} & x^{(2)} & \cdots & x^{(m)} \\
  6. x^{(1)} & x^{(2)} & \cdots & x^{(m)} \\
  7. x^{(1)} & x^{(2)} & \cdots & x^{(m)} \\
  8. \end{matrix}
  9. \right]
  10. $$

\[X =
\left[
\begin{matrix}
x^{(1)} & x^{(2)} & \cdots & x^{(m)} \\
x^{(1)} & x^{(2)} & \cdots & x^{(m)} \\
x^{(1)} & x^{(2)} & \cdots & x^{(m)} \\
\end{matrix}
\right]
\]

希腊字母

见下表

代码 大写 代码 小写
A A \alpha α
B B \beta β
\Gamma Γ \gamma γ
\Delta Δ \delta δ
E E \epsilon ϵ
Z Z \zeta ζ
H H \eta η
\Theta Θ \theta θ
I I \iota ι
K K \kappa κ
\Lambda Λ \lambda λ
M M \mu μ
N N \nu ν
\Xi Ξ \xi ξ
O O \omicron ο
\Pi Π \pi π
P P \rho ρ
\Sigma Σ \sigma σ
T T \tau τ
\Upsilon Υ \upsilon υ
\Phi Φ \phi ϕ
X X \chi χ
\Psi Ψ \psi ψ
\Omega Ω \omega ω

常用数学符号

包括积分符号、集合符号、累乘累加符号等

见下表:

转义符号 效果
\log_{x}y = \arccos z \(\log_{x}y = \arccos z\)
\frac{a} {b} \(\frac{a} {b}\)
_{a}^{b}\textrm{C} \(_{a}^{b}\textrm{C}\)
\frac{\partial {z_x}}{\partial x} \(\frac{\partial {z_x}}{\partial x}\)
\frac{\partial^2 {x}}{\partial x^2} \(\frac{\partial^2 {x}}{\partial x^2}\)
\frac{\mathrm{d} y}{\mathrm{d} x} \(\frac{\mathrm{d} y}{\mathrm{d} x}\)
\int x \(\int x\)
\int_{a}^{b}x \(\int_{a}^{b}x\)
\oint a \(\oint a\)
\oint_{a}^{b}C \(\oint_{a}^{b}C\)
\iint_{a}^{v}C \(\iint_{a}^{v}C\)
\bigcap A \(\bigcap A\)
\bigcap_{a}^{b}C \(\bigcap_{a}^{b}C\)
\bigcup c \(\bigcup c\)
\bigcup_{a}^{b}C \(\bigcup_{a}^{b}C\)
\lim_{c}X \(\lim_{c}X\)
\sum a \(\sum a\)
\sum_{a}^{b}C \(\sum_{a}^{b}C\)
\sqrt{X} \(\sqrt{X}\)
\sqrt[a]{X} \(\sqrt[a]{X}\)
\prod X \(\prod X\)
\prod_{a}^{b} X \(\prod_{a}^{b} X\)
\coprod X \(\coprod X\)
\coprod_{a}^{b} X \(\coprod_{a}^{b} X\)
\left [ a \right ] \(\left [ a \right ]\)
\left ( a\right ) \(\left ( a\right )\)
\left \{ a \right \} \(\left \{ a \right \}\)
\left \langle a \right \rangle \(\left \langle a \right \rangle\)
\left \lfloor a \right \rfloor \(\left \lfloor a \right \rfloor\)
\left \lceil a \right \rceil \(\left \lceil a \right \rceil\)
\supseteqq A \(\supseteqq A\)

二元关系符

\[\begin{array}
& < &\texttt{"<"} & > &\texttt{">"} &= &\texttt{"="}\\
\leq &\texttt{"\leq or \le"} & \geq &\texttt{"\geq or \ge"} &\equiv &\texttt{"\equiv"}\\
\ll &\texttt{"\ll"} & \gg &\texttt{"\gg"} &\doteq &\texttt{"\doteq"}\\
\prec &\texttt{"\prec"} & \succ &\texttt{"\succ"} &\sim &\texttt{"\sim"}\\
\preceq &\texttt{"\preceq"} & \succeq &\texttt{"\succeq"} &\simeq &\texttt{"\simeq"}\\
\subset &\texttt{"\subset"} & \supset &\texttt{"\supset"} &\approx &\texttt{"\approx"}\\
\subseteq &\texttt{"\subseteq"} & \supseteq &\texttt{"\supseteq"} &\approxeq &\texttt{"\approxeq"}\\
\sqsubset &\texttt{"\sqsubset"} & \sqsupset&\texttt{"\sqsupset"} &\Join &\texttt{"\Join"}\\
\sqsubseteq &\texttt{"\sqsubseteq"} & \sqsupseteq&\texttt{"\sqsupseteq"} &\bowtie &\texttt{"\bowtie"}\\
\in &\texttt{"\in"} & \ni &\texttt{"\ni or \owns"} &\propto &\texttt{"\propto"}\\
\vdash &\texttt{"\vdash"} & \dashv &\texttt{"\dashv"} &\models &\texttt{"\models"}\\
\mid &\texttt{"\mid"} & \parallel &\texttt{"\parallel"} &\perp &\texttt{"\perp"}\\
\smile &\texttt{"\smile"} & \frown &\texttt{"\frown"} &\asymp &\texttt{"\asymp"}\\
: &\texttt{":"} & \notin &\texttt{"\notin"} &\neq &\texttt{"\neq or \ne"}\\
\end{array}
\]

三角函数与逻辑数学字符

数学字符 输入 数学字符 输入
± \pm × \times
÷ \div | \mid
∤∤ \nmid \cdot
\circ \ast
\bigodot \bigotimes
\bigoplus \emptyset
\bigvee \bigwedge
\biguplus \bigsqcup
\angle 30^∘ 30 ^ \circ
sin \sin cos \cos
tan \tan cot \cot
\prime \iiint
\iiiint \infty
\nabla \because
\therefore \forall
\exists \not>
\not\subset sec \sec
\uparrow \downarrow
\Uparrow \Downarrow
\rightarrow \leftarrow
\Rightarrow \Leftarrow
\longrightarrow \longleftarrow
\Longrightarrow \Longleftarrow
\quad (空格) # #
\bot

数学字体

字体表

\[\begin{array}
\texttt{"normal"} &\texttt{} & ABCDEFGHIJKLMNOPQRSTUVWXYZ\\
\texttt{"blackboard"} &\texttt{\mathbb} &\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\
\texttt{"boldface"} &\texttt{\mathbf} &\mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\
\texttt{"typewriter"} &\texttt{\mathtt} &\mathtt{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\
\texttt{"roman"} &\texttt{\mathrm} &\mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\
\texttt{"sans-serif"} &\texttt{\mathsf} &\mathsf{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\
\texttt{"calligraphic"}&\texttt{\mathcal} &\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\
\texttt{"script"} &\texttt{\mathscr} &\mathscr{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\
\texttt{"fraktur"} &\texttt{\mathfrak}&\mathfrak{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\
\end{array}
\]

色彩表

\[\begin{array}
\hline
\verb+\color{black}{黑色}+ & \color{black}{黑色} \\
\verb+\color{darkgray}{深灰}+ & \color{darkgray}{深灰}\\
\verb+\color{gray}{灰色}+ & \color{gray}{灰色} \\
\verb+\color{silver}{银色}+ & \color{silver}{银色} \\
\verb+\color{lightgray}{浅灰}+&\color{lightgray}{浅灰}\\
\verb+\color{white}{白色}+ & \color{white}{白色} \\
\hline
\verb+\color{brown}{棕色}+ & \color{brown}{棕色} \\
\verb+\color{maroon}{栗色}+ & \color{maroon}{栗色} \\
\verb+\color{red}{红色}+ & \color{red}{红色} \\
\verb+\color{fuchsia}{桃红}+ & \color{fuchsia}{桃红} \\
\verb+\color{magenta}{品红}+ & \color{magenta}{品红} \\
\verb+\color{pink}{粉红}+ & \color{pink}{粉红} \\
\verb+\color{orange}{橙色}+ & \color{orange}{橙色} \\
\verb+\color{yellow}{黄色}+ & \color{yellow}{黄色} \\
\verb+\color{lime}{青柠}+ & \color{lime}{青柠} \\
\verb+\color{olive}{橄榄}+ & \color{olive}{橄榄} \\
\verb+\color{green}{绿色}+ & \color{green}{绿色} \\
\verb+\color{aqua}{水绿}+ & \color{aqua}{水绿} \\
\verb+\color{cyan}{青色}+ & \color{cyan}{青色} \\
\verb+\color{teal}{靛青}+ & \color{teal}{靛青} \\
\verb+\color{blue}{蓝色}+ & \color{blue}{蓝色} \\
\verb+\color{navy}{海蓝}+ & \color{navy}{海蓝} \\
\verb+\color{violet}{罗兰}+ & \color{purple}{罗兰} \\
\verb+\color{purple}{紫色}+ & \color{purple}{紫色} \\
\hline
\end{array}参考
\]

参考:

https://www.cnblogs.com/nowgood/p/Latexstart.html

http://jzqt.github.io/2015/06/30/Markdown中写数学公式/

https://blog.csdn.net/u014630987/article/details/70156489

https://blog.csdn.net/cclethe/article/details/79022216

编辑你的数学公式——markdown中latex的使用的更多相关文章

  1. Markdown中Latex 数学公式基本语法

    原文地址:http://blog.csdn.net/u014630987/article/details/70156489 Markdown中Latex 数学公式基本语法 公式排版 分为两种排版: - ...

  2. $MarkDown$ 中使用$ \LaTeX$ 数学式

    最近看了些机器学习的书籍, 想写点笔记记录下. 由于需要使用到很多的数学推导, 所以就看了下如何在 Markdown 中插入数学式,发现在 Markdown 中可以直接插入 LaTeX 数学式. 排版 ...

  3. Linux 中优秀的文本化编辑思想大碰撞(Markdown、LaTeX、MathJax)

    这样一个标题可能不太准确,因为确实无法准确地解释什么叫"文本化编辑思想".其实我这篇随笔主要是想探讨 Markdown.LaTeX.MathJax,有兴趣的朋友可以继续往下看,同时 ...

  4. Linux 桌面玩家指南:12. 优秀的文本化编辑思想大碰撞(Markdown、LaTeX、MathJax)

    特别说明:要在我的随笔后写评论的小伙伴们请注意了,我的博客开启了 MathJax 数学公式支持,MathJax 使用$标记数学公式的开始和结束.如果某条评论中出现了两个$,MathJax 会将两个$之 ...

  5. Markdown中实时显示数学公式的方法

    Markdown中实时显示数学公式的方法 Markdown非常好用,但是对于数学公式的实时显示有一些缺陷,如何解决这一问题呢? 一.在线LaTex编辑 点击在线LaTeX编辑方式 在对话框中输入数学公 ...

  6. Markdown中插入数学公式的方法

    Markdown中插入数学公式的方法 文章来源:http://blog.csdn.net/xiahouzuoxin/article/details/26478179 自从使用Markdown以来,就开 ...

  7. Markdown中添加数学公式

    平时写技术博客的时候数学公式还是用的挺多的,之前一直都是在本地写完数学公式之后做成图片添加到博客中,但是这样很不方便.所以现在介绍一种在Markdown中添加数学公式的方法. 使用MathJax引擎 ...

  8. Markdown中插入数学公式

    如果想复杂使用的话,百度Latex公式,找些看一下. 使用MathJax引擎 大家都看过Stackoverflow上的公式吧,漂亮,其生成的不是图片.这就要用到MathJax引擎,在Markdown中 ...

  9. 在MarkDown中插入数学公式对照表(持续更新)

    目录 在MarkDown中可以插入数学公式,但是在博客园和有道云笔记之中的数学公式插入方式略有不同(博客园需要先在后台选项中开启插入数学公式选项): 代码 行内公式 整行公式 博客园 $数学公式$ $ ...

随机推荐

  1. PHP二叉树

    <?php /******************************************************** * 我写的PHP都是从C语言的数据结构中演化而来********* ...

  2. saltstack系列~第四篇

    简介 针对mysql的sls编写0 软件包推送部分  tool_rsync:     file.recurse:        - source: salt://files/mysql        ...

  3. JQuery中的$.getScript()、$.getJson()和$.ajax()方法

    $.getScript() 有时候,在页面初次加载时就取得所需的全部JavaScript文件是完全没有必要的.虽然可以在需要哪个JavaScript文件时,动态地创建<script>标签, ...

  4. Tensorflow datasets.shuffle repeat batch方法

    机器学习中数据读取是很重要的一个环节,TensorFlow也提供了很多实用的方法,为了避免以后时间久了又忘记,所以写下笔记以备日后查看. 最普通的正常情况 首先我们看看最普通的情况: # 创建0-10 ...

  5. Principal components analysis(PCA):主元分析

    在因子分析(Factor analysis)中,介绍了一种降维概率模型,用EM算法(EM算法原理详解)估计参数.在这里讨论另外一种降维方法:主元分析法(PCA),这种算法更加直接,只需要进行特征向量的 ...

  6. BFGS算法(转载)

    转载链接:http://blog.csdn.net/itplus/article/details/21897443 这里,式(2.38)暂时不知如何证出来,有哪位知道麻烦给个思路.

  7. dup,dup2函数【转】

    转自:http://eriol.iteye.com/blog/1180624 转自:http://www.cnblogs.com/jht/archive/2006/04/04/366086.html ...

  8. c语言的重构、清理与代码分析图形化浏览工具: CScout

    网址: https://www.spinellis.gr/cscout/ https://www2.dmst.aueb.gr/dds/cscout/index.html https://github. ...

  9. jq常用功能操作

    //表示所有选中的商品 var $goods=$(".goods:checked"); var arr=[]; for(i=0;i<$goods.length;i++){ a ...

  10. vi与vim

    vi 的使用 基本上 vi 共分为三种模式,分别是『一般模式』.『编辑模式』与『指令列命令模式』. 这三种模式的作用分别是: 一般模式:以 vi 打开一个档案就直接进入一般模式了(这是默认的模式).在 ...