zoukankan      html  css  js  c++  java
  • Latex: 插入数学公式

    1. align equations to left
      To only align one equation, you can
    egin{flalign}
        &	ext{your equation}&
    end{flalign}
    

    To align several equations, you can

    egin{flalign}
        egin{split}
            your equation (1)\
            your equation (2)
        end{split}&
    end{flalign}
    
    1. 插入矩阵大括号[1]
      插入圆括号
    left (
    egin{array}{l l l}
    (omega^2-frac{B_0^2 k^2}{4pi
    ho_0}) & 0 & 0\
    0 & (omega^2-frac{B_0^2 k^2}{4pi
    ho_0}) & 0 \
    0 & 0 & (omega^2-frac{gamma p_0 k_z^2}{
    ho_0^2})\
    end{array}
    
    ight )
    

    插入单边括号

    egin{equation}
    left {
    egin{array}{l}
    (frac{omega}{k_z})^2=frac{B_0^2}{4pi
    ho_0}=V_A^2\
    (frac{omega}{k_z})^2=frac{gamma p_0}{
    ho_0}=V_s^2\
    end{array}
    
    ight .
    end{equation}
    

    其中的大括号可以通过left, ight的命令实现,并且其长度还可以根据矩阵的大小自动调整。注意插入单边括号时,结束处的right . 不可以省略,即便其并没有显示效果。
    3. 给数学公式添加强调方框可以使用boxed命令[2]

    egin{equation}
    oxed{
    
    abla^2vec{E}=mu_0xi_0frac{partial^2vec{E}}{partial t^2}
    }
    end{equation}
    效果如下:
    

    egin{equation}
    oxed{
    abla2vec{E}=mu_0xi_0frac{partial2vec{E}}{partial t^2}
    }
    end{equation}
    4. 插入源代码
    可以使用lstlisting

    usepackage{listings}% insert source codes using list
    egin{lstlisting}
    from sys import path
    path.append('/home/nan/codes/python/test/mod_package/')
    end{lstlisting}
    

    但是这种方式在插入beamer的frame中时会出现错误,需要替代的方法。解决的方法是在frame的后面添加[fragile]参数,l例如:

    egin{frame}[fragile]{Calculate $delta B_0$ from CPSD}
    The mode strength I calculate is from the cross power spectrum of two near mirnov coils. Thus the strength should be:
    egin{lstlisting}
    int main() {
    CStash intStash, stringStash;
    int i;
    char* cp;
    ifstream in;
    string line;
    [...]
    end{lstlisting}
    end{frame}
    

    当然,除了lstlisting可以用,也可以以使用verbatim添加源代码,这时不需要引用额外的库。

    参考:
    For more latex math symbol can be referred from this site: http://web.ift.uib.no/Teori/KURS/WRK/TeX/symALL.html
    [1]https://www.sharelatex.com/learn/Brackets_and_Parentheses
    [2]https://math-linux.com/latex-26/faq/latex-faq/article/how-to-display-formulas-inside-a-box-or-frame-in-latex-boxed

  • 相关阅读:
    POJ 1300 Open Door
    POJ 2230 Watchcow
    codevs 1028 花店橱窗布置
    codevs 1021 玛丽卡
    codevs 1519 过路费
    codevs 3287 货车运输
    codevs 3305 水果姐逛水果街二
    codevs 1036 商务旅行
    codevs 4605 LCA
    POJ 1330 Nearest Common Ancestors
  • 原文地址:https://www.cnblogs.com/docnan/p/5678110.html
Copyright © 2011-2022 走看看