LaTeX数学公式环境

基础知识

1.数学函数:

\sin{}
\cos{}
\tan{}
\arcsin{}
\arccos{}
\arctan{}

\ln{}

\log{}

 

2.常用公式

数学公式分为行内公式与行间公式

  1. 行间公式:$$(双$)
  2. 带编号的行间公式:equation环境
  3. 不带编号的行间公式:\[ \]

 

3.行内公式:

  1. 一对美元符号 $$
  2. 小括号:\(.... \)
  3. mah环境:begin{math} ... end{math}

 

4.行间公式

  1. 一对双美元符号 $$$$

  2. 中括号:\[ ... \]

  3. displaymath环境:\begin{displaymath}...\end{displaymath}

  4. 有编号的行间公式:\begin{equation}...\end{equation}

  5. 无编号的行间公式:\begin{equation*}...\end{equation*}

    注意:无编号公式,需要导入amsmath宏包

\documentclass{article}
\usepackage{ctex}
\usepackage{amsmath}

\begin{document}
\section{行间公式}
\subsection{双美元符号}
交换律是$$a+b=b+a $$如$$1+2=2+1$$

\subsection{中括号}
交换律是 \[a+b=b+a\] 如\[1+2=2+1\]

\subsection{displaymath环境}
交换律是\begin{displaymath}a+b=b+a\label{eq:no2}\end{displaymath}
如\begin{displaymath}1+2=2+1\end{displaymath}

\subsection{自动编号}
交换律见式\ref{eq:no1}
\begin{equation}
a+b=b+a \label{eq:no1}
\end{equation}
如见公式\ref{eq:no2}
\begin{equation}
1+2=2+1
\end{equation}

\subsection{不自动编号}
交换律见式
\begin{equation*}
a+b=b+a \label{eq:no3}
\end{equation*}
如见公式 \ref{eq:no3}
\begin{equation*}
1+2=2+1
\end{equation*}

\end{document}

 

 

数学公式环境

1.基础细节

  1. ** 号问题:在环境中有星号则无编号,无星号有编号。
  2. \ \ :换行
  3. \ref{fig:01}引用标签,\label{fig:01}添加标签,实现交叉引用
  4. \text{文字}:在数学模式中输入文字

2. gather环境

用途:可以写多行公式,对齐方式是整体中间对齐

(1)带编号的

    %多行公式--带编号
    \begin{gather}
        a + b +c = b + a \\
        1+2 = 2 + 1
    \end{gather}

(2)不带编号

(下面的是否带编号类似)

%多行公式--不带编号1
    \begin{gather*}
        a + b = b + a \\
        1+2 = 2 + 1
    \end{gather*}

(3)阻止编号

%多行公式--带编号2 \notag 阻止编号
    \begin{gather}
    a + b = b + a \notag \\
    1+2 = 2 + 1 \notag
    \end{gather}

 

3. align环境

按&号对齐,自己指定对齐方式

% 按&号对齐,--带编号
    \begin{align}
        a+b &= b+a \\
        1+2= & 2+1
    \end{align}

 

4. split环境

当一个公式需要多行排版时,对齐方式也是按&对齐

%一个公式的多行排版--带编号
    \begin{equation}
        \begin{split}
        \cos 2x &= \cos^2 x - \sin^2x \\
        &=2\cos^2x-1
        \end{split} 
    \end{equation}

 

5. cases环境

分段函数或者有左大括号的数学公式

%case环境, text{}在数学模式中处理中文-带编号
    \begin{equation}
        D(x)=\begin{cases}
        1, & \text{如果} x \in \mathbb{Q};\\
        0, & \text{如果} x \in \mathbb{R}\setminus\mathbb{Q}
        \end{cases}
    \end{equation}

发布了118 篇原创文章 · 获赞 63 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/qq_42185999/article/details/104255134