1. 程式人生 > >LaTeX數學公式編輯(2)——跨頁公式

LaTeX數學公式編輯(2)——跨頁公式

1. 引言

寫小論文和畢業論文的過程中, 難免會出現較長的公式. 如果運氣好, 這個公式剛好在一頁之內, 對排版沒有影響; 如果這個公式恰好是上一頁放不下, 放到下一頁的話, 上一頁又空一大片, 這樣就很不美觀了.
在LaTeX中, \begin{equation}...\end{equation}命令是不允許跨頁的, 這時\begin{align}...\end{align}就是一個最好的選擇了. 同時, 需要在導言區加上命令\allowdisplaybreaks[4]

. 括號中的引數可為1,2,3,4。數值越大,執行跨頁的強度越大.
下面兩節給出編號和不編號的示例.

2. 不編號公式

命令

\begin{align*}
	\cos 2x = & \cos^2 x - \sin^2 x \\
	= & 2\cos^2 x - 1\\
	= & 1 - 2\sin^2 x\\
	= & \cos^2 x - \sin^2 x \\
	= & 2\cos^2 x - 1.
\end{align*}

的執行結果為
這裡寫圖片描述

3. 編號公式

\begin{align}...\end{align}中如果沒有加星號, 就會對其中的每一行公式編號, 這常常不是我們想要的. 所以在此我們使用命令\notag

來阻止編號. 命令

\begin{align}
	\cos 2x = & \cos^2 x - \sin^2 x \notag \\
	= & 2\cos^2 x - 1 \notag \\
	= & 1 - 2\sin^2 x \notag \\
	= & \cos^2 x - \sin^2 x \notag \\
	= & 2\cos^2 x - 1
\end{align}

中, \notag 阻止了前四行的編號, 只對第5行編號, 執行結果為
這裡寫圖片描述

4. 說明

對於跨頁公式, 也許有更好的辦法來處理.