latex in typora

在typora编辑器使用latex公式,基本的语法,用来当自用手册查询

参考Typora中利用LaTeX 插入数学公式_typora插入latex公式-CSDN博客

hexo开启latex渲染功能

  1. 安装Hexo-Math: Hexo-Math是Hexo的一个插件,它支持LaTeX数学公式,并且可以通过MathJax来渲染。

    打开终端或命令提示符,进入您的Hexo项目目录,然后运行以下命令来安装Hexo-Math:

    1
    npm install hexo-math --save
  2. 配置Hexo主配置文件: 打开您的Hexo配置文件(通常是_config.yml),然后添加或修改以下配置项:

    1
    2
    3
    4
    5
    math:
    enable: true
    engine: mathjax
    mathjax:
    cdn: //cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js?config=TeX-AMS-MML_HTMLorMML

    这里enable: true表示启用数学公式支持,engine: mathjax指定使用MathJax引擎,cdn是MathJax的CDN链接。

  3. 然后在要使用的md文档添加 math: true ,不要忘记这个了

LaTeX 编辑数学公式基本语法元素

数学公式有两种形式: inline 和 display

  • inline(行间公式):在正文插入数学公式,用$...$ 将公式括起来

  • display(快间公式) :独立排列的公式,用 $$...$$将公式括起来,默认显示在行中间

  • 各类希腊字母表:

    eg: $\alpha$:$\alpha$

    在这里插入图片描述

上下标、根号、省略号

  • 下标:_ eg: $x_2$

  • 上标:^ eg: $x^2$

    注意:上下标如果多于一个字母或者符号,需要用一对{}括起来

    eg: $x_{il}$ 、$x^{2y}$

  • 根号:\sqrt eg: $\sqrt{5}$

  • 省略号:\dots \cdots 分别表示 $\dots$ $ \cdots$

运算符

基本预算符: $\pm$ $\div$

  • 求和: \sum_1^n : $\sum_1^n$
  • 积分:\int_1^n: $\int_1^n$

  • 极限:lim_{x \to \infty} : $ lim_{x \to \infty}$

  • 分数:\frac{}{} 如: $\frac{3}{8}$

  • 矩阵与行列式

    矩阵:$$\begin{matrix}...\end{matrix}$$

    • 使用&分隔同行元素
    • \ 换行。

    $$ \begin{matrix} 1 & x & x^2\ 1 & y & y^2\ 1 & z & z^2\ \end{matrix} $$

  • 行列式

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    $$
    X=\left|
    \begin{matrix}
    x_{11} & x_{12} & \cdots & x_{1d}\\
    x_{21} & x_{22} & \cdots & x_{2d}\\
    \vdots & \vdots & \ddots & \vdots \\
    x_{11} & x_{12} & \cdots & x_{1d}\\
    \end{matrix}
    \right|
    $$

$$
\left|
\begin{matrix}
x_{11} & x_{12} & \cdots & x_{1d}\
x_{21} & x_{22} & \cdots & x_{2d}\
\vdots & \vdots & \ddots & \vdots \
x_{11} & x_{12} & \cdots & x_{1d}\
\end{matrix}
\right|
$$

  • 分隔符

    各种括号用 () [] { } \langle\rangle 等命令表示,注意花括号通常用来输入命令和环境的参数,所以在数学公式中它们前面要加 \。可以在上述分隔符前面加 \big \Big \bigg \Bigg 等命令来调整大小。

  • 箭头

    1
    $\leftarrow$

    $\leftarrow$

    在这里插入图片描述

  • 方程式

    1
    E=mc^2

    $E=mc^2$

  • 分段函数

    1
    2
    3
    4
    5
    6
    7
    $$
    f(n)=
    \begin{cases}
    n/2, & \text{if $n$ is even}\\
    3n+1,& \text{if $n$ is odd}
    \end{cases}
    $$

    $$
    f(n)=

    \begin{cases}
        n/2, & \text{if $n$ is even}\\
        3n+1,& \text{if $n$ is odd}
    \end{cases}
    

    $$

  • 方程组

    1
    2
    3
    4
    5
    6
    7
    8
    9
    $$
    \left\{
    \begin{array}{c}
    a_1x+b_1y+c_1z=d_1\\
    a_2x+b_2y+c_2z=d_2\\
    a_3x+b_3y+c_3z=d_3
    \end{array}
    \right.
    $$

$$
\left{
\begin{array}{c}
a_1x+b_1y+c_1z=d_1\
a_2x+b_2y+c_2z=d_2\
a_3x+b_3y+c_3z=d_3
\end{array}
\right.
$$


latex in typora
http://example.com/2024/05/25/latex-in-typora/
Author
Jianhui Yin
Posted on
May 25, 2024
Licensed under