大模型系列8-Latex
- 背景
 - Latex符号
 - 符号加帽子、横线和波浪线
 - 求和连乘
 - 希腊字母
 - 等于约等于
 - 积分微分
 - 公式对齐
 - 算法
 - 矩阵
 
背景
目前正通过论文、博客、视频、文档等各种形式学习各种大模型知识。为了更好的记录,写了一些大模型的博客,不专业,只备忘。写博客的过程中,会不断地遇到Latex数学符号的事情。前几年写论文很常用,但是现在过了几年了,基本都忘得差不多了,于是乎专门记录一个博客,将常用的Latex符号给记录下,便于未来帮助查看。
Latex符号
符号加帽子、横线和波浪线
\bar{x} =  
     
      
       
        
        
          x 
         
        
          ˉ 
         
        
       
      
        \bar{x} 
       
      
    xˉ
 \hat{x} =  
     
      
       
        
        
          x 
         
        
          ^ 
         
        
       
      
        \hat{x} 
       
      
    x^
 \dot{x} =  
     
      
       
        
        
          x 
         
        
          ˙ 
         
        
       
      
        \dot{x} 
       
      
    x˙
 \ddot{x} =  
     
      
       
        
        
          x 
         
        
          ¨ 
         
        
       
      
        \ddot{x} 
       
      
    x¨
 \widetilde{x} =  
     
      
       
        
        
          x 
         
        
          ~ 
         
        
       
      
        \widetilde{x} 
       
      
    x 
           
求和连乘
\sum_{i=1}^{n} =  
     
      
       
        
        
          ∑ 
         
         
         
           i 
          
         
           = 
          
         
           1 
          
         
        
          n 
         
        
       
      
        \sum_{i=1}^{n} 
       
      
    ∑i=1n
 \prod_{i=1}^{n} =  
     
      
       
        
        
          ∏ 
         
         
         
           i 
          
         
           = 
          
         
           1 
          
         
        
          n 
         
        
       
      
        \prod_{i=1}^{n} 
       
      
    ∏i=1n
 \sigma =  
     
      
       
       
         σ 
        
       
      
        \sigma 
       
      
    σ
希腊字母
参考: https://blog.csdn.net/xxzhangx/article/details/52778539
 
等于约等于
约等于 a \approx b = a ≈ b a \approx b a≈b
大于约等于 a \gtrsim b = a ≳ b a \gtrsim b a≳b
小于约等于 a \lesssim b =  
     
      
       
       
         a 
        
       
         ≲ 
        
       
         b 
        
       
      
        a \lesssim b 
       
      
    a≲b
 波浪 a \sim b =  
     
      
       
       
         a 
        
       
         ∼ 
        
       
         b 
        
       
      
        a \sim b 
       
      
    a∼b
 波浪 a \simeq b =  
     
      
       
       
         a 
        
       
         ≃ 
        
       
         b 
        
       
      
        a \simeq b 
       
      
    a≃b
积分微分
\frac{dy}{dx} =  
     
      
       
        
         
         
           d 
          
         
           y 
          
         
         
         
           d 
          
         
           x 
          
         
        
       
      
        \frac{dy}{dx} 
       
      
    dxdy
 \frac{\partial y}{\partial x} =  
     
      
       
        
         
         
           ∂ 
          
         
           y 
          
         
         
         
           ∂ 
          
         
           x 
          
         
        
       
      
        \frac{\partial y}{\partial x} 
       
      
    ∂x∂y
公式对齐
\begin{align*}
 A &= B + C \\
 &= C + D + C \\
 &= 2C + D
 \end{align*}
A = B + C = C + D + C = 2 C + D \begin{align*} A &= B + C \\ &= C + D + C \\ &= 2C + D \end{align*} A=B+C=C+D+C=2C+D
算法
\begin{algorithm}[!h]
 \caption{algorithm of SUM}
 \label{alg:AOA}
 \renewcommand{\algorithmicrequire}{\textbf{Input:}}
 \renewcommand{\algorithmicensure}{\textbf{Output:}}
 \begin{algorithmic}[1]
 \REQUIRE  
     
      
       
       
         A 
        
       
      
        A 
       
      
    A,  
     
      
       
       
         B 
        
       
      
        B 
       
      
    B,  
     
      
       
       
         C 
        
       
      
        C 
       
      
    C %%input
 \ENSURE EEEEE %%output
    \STATE  AAAAA
    \WHILE{$A=B$}
        \STATE BBBBB
    \ENDWHILE
    
    \FOR{each $i \in [1,10]$}
        \IF {$C = 0$}
            \STATE CCCCC
        \ELSE
            \STATE DDDDD
        \ENDIF
    \ENDFOR
    \RETURN EEEEE
\end{algorithmic}
 
\end{algorithm}
KaTeX parse error: No such environment: algorithm at position 8: \begin{̲a̲l̲g̲o̲r̲i̲t̲h̲m̲}̲ \caption{A} \l…
矩阵
参考:https://www.acwing.com/blog/content/3067/
E=
\left(
\begin{matrix}
1 & 0 & \cdots & 0 \\
0 & 1 & \cdots & 0 \\
\vdots & \vdots & \vdots & \vdots \\
0 & 0 & \cdots & 1 \\
\end{matrix}
\right)
 
E = ( 1 0 ⋯ 0 0 1 ⋯ 0 ⋮ ⋮ ⋮ ⋮ 0 0 ⋯ 1 ) E= \left( \begin{matrix} 1 & 0 & \cdots & 0 \\ 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \vdots \\ 0 & 0 & \cdots & 1 \\ \end{matrix} \right) E= 10⋮001⋮0⋯⋯⋮⋯00⋮1 
中括号
E=
\left[
\begin{matrix}
1 & 0 & \cdots & 0 \\
0 & 1 & \cdots & 0 \\
\vdots & \vdots & \vdots & \vdots \\
0 & 0 & \cdots & 1 \\
\end{matrix}
\right]
 
E = [ 1 0 ⋯ 0 0 1 ⋯ 0 ⋮ ⋮ ⋮ ⋮ 0 0 ⋯ 1 ] E= \left[ \begin{matrix} 1 & 0 & \cdots & 0 \\ 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \vdots \\ 0 & 0 & \cdots & 1 \\ \end{matrix} \right] E= 10⋮001⋮0⋯⋯⋮⋯00⋮1 


















