Latex tip 207: Tips for using align environment to enter multi-line formulas

Source: Internet
Author: User

Align is the best use of the input multi-line formula in the environment, is only a personal humble opinion, because his alignment is very flexible, if we need a very smart alignment of the multi-line formula, it is recommended to use the Align environment, the corresponding also has align* and aligned and other similar environment, here no longer detailed. The following provides the code to show its graceful.
Demo:






Demo Code:
\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 a 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 a 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 a 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) = 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) = 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}

From:http://blog.sina.com.cn/s/blog_5e16f1770100gror.html

Latex tip 207: Tips for using align environment to enter multi-line formulas

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.