align latex 使用_Latex中使用align来对齐多行公式的排版技巧 | 学步园

本文介绍了如何在LaTeX中使用`align`环境进行多行数学公式对齐和排版,包括不同列数的设置、间距调整以及与其他环境的配合使用,提供多个实例展示其效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

示例显示的结果如下:

829b2c4cdd866dcdffd93acf256997f5.png

b1f8f40a377efaa22cf6eaa38f7f972d.png

Latex代码如下:

\documentclass{article}

\pagestyle{empty}

\setcounter{page}{6}

\setlength\textwidth{266.0pt}

\usepackage{CJK}

\usepackage{amsmath}

\begin{CJK}{GBK}{song}

\begin{document}

\begin{align}

(a + b)^3 &= (a + b) (a + b)^2 \\

&= (a + b)(a^2 + 2ab + b^2) \\

&= a^3 + 3a^2b + 3ab^2 + b^3

\end{align}

\begin{align}

x^2 + y^2 & = 1 \\

x & = \sqrt{1-y^2}

\end{align}

This example has two column-pairs.

\begin{align} \text{Compare }

x^2 + y^2 &= 1 &

x^3 + y^3 &= 1 \\

x &= \sqrt {1-y^2} &

x &= \sqrt[3]{1-y^3}

\end{align}

This example has three column-pairs.

\begin{align}

x &= y & X &= Y &

a &= b+c \\

x' &= y' & X' &= Y' &

a' &= b \\

x + x' &= y + y' &

X + X' &= Y + Y' & a'b &= c'b

\end{align}

This example has two column-pairs.

\begin{flalign} \text{Compare }

x^2 + y^2 &= 1 &

x^3 + y^3 &= 1 \\

x &= \sqrt {1-y^2} &

x &= \sqrt[3]{1-y^3}

\end{flalign}

This example has three column-pairs.

\begin{flalign}

x &= y & X &= Y &

a &= b+c \\

x' &= y' & X' &= Y' &

a' &= b \\

x + x' &= y + y' &

X + X' &= Y + Y' & a'b &= c'b

\end{flalign}

This example has two column-pairs.

\renewcommand\minalignsep{0pt}

\begin{align} \text{Compare }

x^2 + y^2 &= 1 &

x^3 + y^3 &= 1 \\

x &= \sqrt {1-y^2} &

x &= \sqrt[3]{1-y^3}

\end{align}

This example has three column-pairs.

\renewcommand\minalignsep{15pt}

\begin{flalign}

x &= y & X &= Y &

a &= b+c \\

x' &= y' & X' &= Y' &

a' &= b \\

x + x' &= y + y' &

X + X' &= Y + Y' & a'b &= c'b

\end{flalign}

\renewcommand\minalignsep{2em}

\begin{align}

x &= y && \text{by hypothesis} \\

x' &= y' && \text{by definition} \\

x + x' &= y + y' && \text{by Axiom 1}

\end{align}

\begin{equation}

\begin{aligned}

x^2 + y^2 &= 1 \\

x &= \sqrt{1-y^2} \\

\text{and also }y &= \sqrt{1-x^2}

\end{aligned} \qquad

\begin{gathered}

(a + b)^2 = a^2 + 2ab + b^2 \\

(a + b) \cdot (a - b) = a^2 - b^2

\end{gathered} \end{equation}

\begin{equation}

\begin{aligned}[b]

x^2 + y^2 &= 1 \\

x &= \sqrt{1-y^2} \\

\text{and also }y &= \sqrt{1-x^2}

\end{aligned} \qquad

\begin{gathered}[t]

(a + b)^2 = a^2 + 2ab + b^2 \\

(a + b) \cdot (a - b) = a^2 - b^2

\end{gathered}

\end{equation}

\newenvironment{rcase}

{\left.\begin{aligned}}

{\end{aligned}\right\rbrace}

\begin{equation*}

\begin{rcase}

B' &= -\partial\times E \\

E' &= \partial\times B - 4\pi j \,

\end{rcase}

\quad \text {Maxwell's equations}

\end{equation*}

\begin{equation} \begin{aligned}

V_j &= v_j &

X_i &= x_i - q_i x_j &

&= u_j + \sum_{i\ne j} q_i \\

V_i &= v_i - q_i v_j &

X_j &= x_j &

U_i &= u_i

\end{aligned} \end{equation}

\begin{align}

A_1 &= N_0 (\lambda ; \Omega')

- \phi ( \lambda ; \Omega') \\

A_2 &= \phi (\lambda ; \Omega')

\phi (\lambda ; \Omega) \\

\intertext{and finally}

A_3 &= \mathcal{N} (\lambda ; \omega)

\end{align}

\end{CJK}

\end{document}

编译命令如下:

pdflatex main

pdflatex main

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值