日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發布時間:2024/3/26 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 数学公式排版——多行公式 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

數學公式排版——多行公式

  • 羅列多個公式
  • 拆分1個長公式
  • 將公式組合1個公式

羅列多個公式

在公式環境中換行命令\\是無效的,可以:

  • 使用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}

總結

以上是生活随笔為你收集整理的数学公式排版——多行公式的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。