{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## 1 Markdown 中使用LaTex基础语法" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "LaTeX 公式有两种,一种是用在正文中的,一种是单独显示的。\n", "\n", "正文中的公式如下: \n", "\n", "$ \\$...\\$ $\n", "\n", "单独一行显示的时候使用如下命令:\n", "\n", "$ \\$\\$...\\$\\$ $\n", "\n", "其中, \\$符号中间包含的三个点表格的是LaTex的公式命令。" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**举个例子如下:**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "行内公式 $ f(x) = \\sum_{i=0}^{N} \\int_{a}^{b} g(t,i) \\text{d}t $ 行内公式\n", "\n", "下面是单独一行显示:\n", "\n", " $$ f(x) = \\sum_{i=0}^{N} \\int_{a}^{b} g(t,i) \\text{d}t \\tag{a}$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "编辑上述公式的代码如下:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "行内公式 $ f(x) = \\sum_{i=0}^{N} \\int_{a}^{b} g(t,i) \\text{d}t $ 行内公式\n", "\n", "下面是单独一行显示:\n", "\n", " $$ f(x) = \\sum_{i=0}^{N} \\int_{a}^{b} g(t,i) \\text{d}t \\tag{a}$$\n", " ```\n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2 常用数学表达命令" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.1 指数和下标" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "指数和下标可以用 ^ 和 _ 后加相应字符来实现。比如:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "LaTex命令| 显示结果 | LaTex命令| 显示结果 | LaTex命令| 显示结果 \n", "- |- | - | - | - | -\n", "a_{1} | $a_{1}$ | x^{2} | $x^{2}$| \\sum_{i=1}^{N} | $\\sum_{i=1}^{N} $" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.2 平方根和n次方根" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "平方根的输入命令为 \\sqrt , n次方根的命令为 \\sqrt[n]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "LaTex命令| 显示结果 | LaTex命令| 显示结果 | LaTex命令| 显示结果 \n", "- |- | - | - | - | -\n", "\\sqrt{x} | $\\sqrt{x}$ | \\sqrt[3]{4} | $\\sqrt[3]{4}$| \\sqrt{x^2+y^2} | $ \\sqrt{x^2+y^2} $" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "$$\\sqrt{x^{2}+\\sqrt{y}} \\tag{2-1}$$\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\\sqrt{x^{2}+\\sqrt{y}} \\tag{2-1}$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.3 上下水平线" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "命令 \\overline 和 \\underline 在表达式的上、下方画出水平线。比如:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "LaTex命令| 显示结果 | LaTex命令| 显示结果 \n", "- |- | - | - | - | -\n", "\\overline{x+y} | $ \\overline{x+y} $ | \\underline{x+y} | $ \\underline{x+y} $" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.4 上下大括号" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "命令 \\overbrace 和 \\underbrace 在表达式上、下方画出一个水平的大括号。比如:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "$$\n", "\\underbrace{1+2+3+\\cdots+100}_{100}\n", "\\tag{2-2}\n", "$$\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\underbrace{1+2+3+\\cdots+100}_{100}\n", "\\tag{2-2}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.5 向量" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "向量通常是上方有小箭头的变量表示。这可以由 \\vec 得到。 在定义从 A 到 B 的向量时,命令 \\overrightarrow 和 \\overleftarrow 非常有用。比如:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "LaTex命令| 显示结果 | LaTex命令| 显示结果 \n", "- |- | - | - | - | -\n", "\\vec a | $ \\vec a $ | \\overrightarrow{AB} | $ \\overrightarrow{AB} $" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.6 其他" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "其他,比如 分数可以用 \\frac 命令, 求和可以用 \\sum 命令, 乘积运算可以用 \\prod 生成, 积分可以用 \\int 命令。部分示例如下:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "\n", "LaTex命令| 显示结果 | LaTex命令| 显示结果 | LaTex命令| 显示结果 \n", "- |- | - | - | - | -\n", "\\sum | $\\sum$ | \\int | $\\int$| \\sum_{i=1}^{N} | $\\sum_{i=1}^{N} $\n", "\\int_{a}^{b} | $\\int_{a}^{b}$ | \\prod | $\\prod$| \\iint | $\\iint $\n", "\\prod_{i=1}^{N} | $\\prod_{i=1}^{N}$ | \\iint_{a}^{b} | $\\iint_{a}^{b}$| \\bigcup | $\\bigcup $\n", "\\bigcap | $\\bigcap$ | \\bigcup_{i=1}^{N} | $\\bigcup_{i=1}^{N}$| \\bigcap_{i=1}^{N} | $\\bigcap_{i=1}^{N} $\n", "\\sqrt[3]{2} | $\\sqrt[3]{2}$ | \\sqrt{3} | $\\sqrt{3}$| x_{3} | $ x_{3} $\n", "\\lim_{x \\to 0} | $\\lim_{x \\to 0}$ | \\frac{1}{2} | $\\frac{1}{2}$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3 矩阵编辑" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "生成矩阵使用的命令如下:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "$$\\begin{matrix}\n", "...\n", "\\end{matrix}$$\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "其中 … 表示的是 LaTeX 的矩阵命令,矩阵命令中每一行以 \\ 结束,矩阵的元素之间用 & 来分隔开。举例如下:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "$$\n", "\\begin{matrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{matrix} \\tag{3-1}\n", "$$\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\begin{matrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{matrix} \\tag{3-1}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "上述矩阵显示的不是很美观,可以给矩阵加上括号,加括号的方式有多种。" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1 带括号的矩阵 \\left \\right" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "$$\n", "\\left \\{\n", "\\begin{matrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{matrix} \n", "\\right \\} \\tag{3-2}\n", "$$\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\left \\{\n", "\\begin{matrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{matrix} \n", "\\right \\} \\tag{3-2}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "或者:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "$$\n", "\\left [\n", "\\begin{matrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{matrix} \n", "\\right ] \\tag{3-3}\n", "$$\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\left [\n", "\\begin{matrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{matrix} \n", "\\right ] \\tag{3-3}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.2 带括号的矩阵 \\bmatrix \\Bmatrix" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "$$\n", "\\begin{bmatrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{bmatrix} \n", " \\tag{3-4}\n", "$$\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\begin{bmatrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{bmatrix} \n", " \\tag{3-4}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "或者:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "$$\n", "\\begin{Bmatrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{Bmatrix} \n", " \\tag{3-5}\n", "$$\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\begin{Bmatrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{Bmatrix} \n", " \\tag{3-5}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.3 带括号的矩阵 \\vmatrix \\Vmatrix" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "$$\n", "\\begin{vmatrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{vmatrix} \n", " \\tag{3-6}\n", "$$\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\begin{vmatrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{vmatrix} \n", " \\tag{3-6}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "或者:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "$$\n", "\\begin{Vmatrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{Vmatrix} \n", " \\tag{3-7}\n", "$$\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\begin{Vmatrix}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{Vmatrix} \n", " \\tag{3-7}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.4 带省略号的矩阵" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "如果矩阵元素太多,可以用 \\cdots $\\cdots$ \\ddots $\\ddots$ \\vdots $\\vdots$ 等省略符号来定义矩阵。" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "$$\n", "\\begin{bmatrix}\n", "1 & 2 & \\cdots & 4 \\\\\n", "7 & 6 & \\cdots & 5 \\\\\n", "\\vdots & \\vdots & \\ddots & \\vdots \\\\\n", "8 & 9 & \\cdots & 10\n", "\\end{bmatrix} \\tag{3-8}\n", "$$\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\begin{bmatrix}\n", "1 & 2 & \\cdots & 4 \\\\\n", "7 & 6 & \\cdots & 5 \\\\\n", "\\vdots & \\vdots & \\ddots & \\vdots \\\\\n", "8 & 9 & \\cdots & 10\n", "\\end{bmatrix} \\tag{3-8}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.5 带参数的矩阵" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "写增广矩阵,可能需要最右边一列单独考虑。可以用array命令来处理:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "$$\n", "\\left [\n", "\\begin{array}{cc|c}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{array}\n", "\\right ]\n", " \\tag{3-9}\n", "$$\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\left [\n", "\\begin{array}{cc|c}\n", "1 & 2 & 3 \\\\\n", "4 & 5 & 6 \\\\\n", "7 & 8 & 9\n", "\\end{array}\n", "\\right ]\n", " \\tag{3-9}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.6 行内矩阵" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "可以使用 \\big( 和 \\big) 来定义行间矩阵。Demo如下:\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "这是行内矩阵的Demo:\n", "$\\big( \n", " \\begin{smallmatrix}\n", " 1 & 2 & 3 \\\\\n", " 4 & 5 & 6 \\\\\n", " 7 & 8 & 9\n", " \\end{smallmatrix}\n", " \\big)$ 后面还有……\n", " ```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "这是行内矩阵的Demo:\n", "$\\big( \n", " \\begin{smallmatrix}\n", " 1 & 2 & 3 \\\\\n", " 4 & 5 & 6 \\\\\n", " 7 & 8 & 9\n", " \\end{smallmatrix}\n", " \\big)$ 后面还有……" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "或者:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "这是行内矩阵的Demo:\n", "$ \n", " \\begin{bmatrix}\n", " 1 & 2 & 3 \\\\\n", " 4 & 5 & 6 \\\\\n", " 7 & 8 & 9\n", " \\end{bmatrix} \n", "$ 后面还有……\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "这是行内矩阵的Demo:\n", "$ \n", " \\begin{bmatrix}\n", " 1 & 2 & 3 \\\\\n", " 4 & 5 & 6 \\\\\n", " 7 & 8 & 9\n", " \\end{bmatrix} \n", "$ 后面还有……" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## LaTex 常用数学符号整理" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "