数学公式排版——多行公式

罗列多个公式

在公式环境中换行命令\\是无效的,可以:

  • 使用gather(gather*)环境。
    (1)区别仅为可以使用\\进行换行(gather环境表示编号,gather*则不编号)
    注意:gather(gather环境得到的公式是每行居中的)
    (2)可以在\\前使用命令\notag,表示阻止指定的行不编号
    在这里插入图片描述
\begin{gather}
\varphi :f(x)=x^2 \notag \\
\varphi \colon f(x)=x^2
\end{gather}
  • 使用align环境
    此环境下公式可按等号或其他关系符对齐(在关系符前加&表示对齐。)
    在这里插入图片描述
\begin{align}
&\varphi :f(x)=x^2 \notag \\
&\varphi \colon f(x)=x^2+1
\end{align}

注意:一种特殊情况
在这里插入图片描述

\begin{align}
& x^2 +1\notag\\
 ={}&5^2+1    %注意{}的使用
\end{align}

-使用flalign环境
与align环境类似。可将公式分为2列,分别向左向右对齐,公式中间的间距可以无限延伸
在这里插入图片描述

\begin{flalign}
& f(x)=2t+1 & &f(2)=5\\
& g(x)=t & &g(2)=2
\end{flalign}

-使用alignat环境:
与flalign环境相反,每列之间不产生间距,但可手动增加间距。如间距为\quad的距离(1em)
在这里插入图片描述

\begin{alignat}{2}    %2表示列数为2&f(x)=2t+1 &\quad &f(2)=5\\
& g(x)=t &\quad  &g(2)=2
\end{alignat}
  • 需要在公式中间插入一行文字又不打破公式的对齐时可以使用\intertex或、\shortintertextt命令(行间距更紧凑一些)
    在这里插入图片描述
\begin{align}
&f(x)=2t+1
\intertext{将$x=2带入得$}
&f(2)=5
\end{align}
\begin{align}
&f(x)=2t+1
\shortintertext{将$x=2带入得$}
&f(2)=5
\end{align}
  • 罗列多个公式时,经常使用subequations环境,此环境内的多个公式被视为一个公式,使用相同的主编号
    在这里插入图片描述
\begin{subequations}
	\begin{align}
	&f(x)=a_{11}x_1+a_{12}x+_2+a_{13}x_3=b_1\\
	&f(x)=a_{21}x_1+a_{22}x+_2+a_{23}x_3=b_2\\
	&f(x)=a_{31}x_1+a_{32}x+_2+a_{33}x_3=b_3
	\end{align}
\end{subequations}

拆分1个长公式

-使用multline环境。
使用\\换行,各行对齐方式:第一行左对齐,最后一行右对齐,中间行居中对齐
在这里插入图片描述

\begin{multline}
\qquad\qquad f(x)=1+2+3+6+1+8\\
	+5+9+16+4+3\\
	+1+2+4+8+9\\
	+1+5+9\qquad \qquad 
\end{multline}

注意:multline环境首尾两行和版心边界的间距由长度变量\multlinegap{2em}和\multlinetaggap{5em}控制
同时也可以使用\shoveleft 和 \shoveright命令指定中间的行左对齐或右对齐
在这里插入图片描述

\setlength{\multlinegap}{8em}
\setlength{\multlinetaggap}{10em}
\begin{multline}
1+2+3+6+1+8\\
 \shoveleft{+5+9+16+4+3}\\
	\shoveright{+1+2+4+8+9}\\
	+1+5+9
\end{multline}
  • 使用split环境用在equation、gather等数环境中,可把单个公式拆分为多行,且支持align的对齐方式
    在这里插入图片描述
\begin{equation}
\begin{split}
\cos 2x &= \cos^2x -\sin^2x\\
           &=2\cos^2x-1\\
           &=1-2\sin^2x
\end{split}
\end{equation}

将公式组合1个公式

  • gathered环境
    把几行公式居中排列,组合为一个整体。
    在这里插入图片描述

  • lgathered和rgathered环境
    作用于lgather,rgather相同
    在这里插入图片描述

  • aligned、alignedat环境
    使用方法同align,alignat

  • multlined环境
    可把拆行的长公式作为一个块使用
    在这里插入图片描述
    注意
    在这里插入图片描述

  • cases环境(mathtools宏包下)
    将几个公式前面用花括号“{”括起来
    mathtools宏包还提供了dcases环境,保证每行公式显式的格式大小相同。
    在这里插入图片描述

\begin{equation}
f(x)=\begin{cases}
\cos 2x ,& \text{if}\quad x\in(0,\infty)\\
\sin2x ,& \text{if}\quad x\in(-\infty,0)  
\end{cases}
\end{equation}
  • numcases环境(在cases宏包中)
    在每行公式后面增加编号
    \begin{numcases}{左边的子公式}
    子公式1 & 条件1 \
    子公式2 & 条件2 \

    \end{numcases}

在这里插入图片描述

%这里是导言区
\usepackage{cases}
%这里是正文
\begin{numcases}{f(x)=}
	\cos 2x & if $ x\in(0,\infty)$\\
	\sin2x & if $ x\in(-\infty,0) $ 
\end{numcases}
  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值