如何独立分割和对齐 LHS 和 RHS?

如何独立分割和对齐 LHS 和 RHS?

我想要获得以下结果,其中扩展的每个步骤都被拆分,左侧和右侧独立地与不同的垂直线对齐。

目的是说明红色表达式可以省略。

在此处输入图片描述

我的尝试如下,不知道这里应该用什么环境。

在此处输入图片描述

\documentclass[12pt]{article}
\usepackage{mathtools}
\usepackage[a6paper,hmargin=5mm,bottom=13mm,top=5mm]{geometry}
\usepackage{xcolor}
\parindent=0pt\relax

\begin{document}
\textbf{Question}:\\
Expand $(x-1)(x-2)(x-3)(x-4)$.

\textbf{Answer}:
\begin{multline*}
(x-1)(x-2)(x-3)(x-4)\\
 = (x-1) (x-2) (x^2 -4x -3x +12)\\
{\color{red}(x-1)(x-2)(x-3)(x-4)}\\
= (x-1) (x-2) (x^2 -7x +12)\\
{\color{red}(x-1)(x-2)(x-3)(x-4)}\\
= (x-1) (x^3 -7x^2 +12x -2x^2 +14x -24)\\
{\color{red}(x-1)(x-2)(x-3)(x-4)}\\
= (x-1) (x^3 -9x^2 +26x -24)\\
{\color{red}(x-1)(x-2)(x-3)(x-4)}\\
= x^4 -9x^3 +26x^2 -24x -x^3 +9x^2 -26x +24 \\
{\color{red}(x-1)(x-2)(x-3)(x-4)}\\
= x^4 -10x^3 +35x^2 -50x  +24 
\end{multline*}
\newpage

Simplified version:
\begin{multline*}
(x-1)(x-2)(x-3)(x-4)\\
\begin{aligned}
&= (x-1) (x-2) (x^2 -4x -3x +12)\\
&= (x-1) (x-2) (x^2 -7x +12)\\
&= (x-1) (x^3 -7x^2 +12x -2x^2 +14x -24)\\
&= (x-1) (x^3 -9x^2 +26x -24)\\
&= x^4 -9x^3 +26x^2 -24x -x^3 +9x^2 -26x +24 \\
&= x^4 -10x^3 +35x^2 -50x  +24 
\end{aligned}
\end{multline*}

\end{document}

答案1

您可以align*在两种情况下使用:

\documentclass[12pt]{article}
\usepackage[a6paper,hmargin=5mm,bottom=13mm,top=5mm]{geometry}
\usepackage{mathtools}
\usepackage{xcolor}

\setlength{\parindent}{0pt}

\begin{document}

\textbf{Question}:\\
Expand $(x-1)(x-2)(x-3)(x-4)$.

\textbf{Answer}:
\begin{align*}
\MoveEqLeft[1] (x-1)(x-2)(x-3)(x-4)\\
&= (x-1) (x-2) (x^2 -4x -3x +12)\\
\MoveEqLeft[1] \textcolor{red}{(x-1)(x-2)(x-3)(x-4)}\\
&= (x-1) (x-2) (x^2 -7x +12)\\
\MoveEqLeft[1] \textcolor{red}{(x-1)(x-2)(x-3)(x-4)}\\
&= (x-1) (x^3 -7x^2 +12x -2x^2 +14x -24)\\
\MoveEqLeft[1] \textcolor{red}{(x-1)(x-2)(x-3)(x-4)}\\
&= (x-1) (x^3 -9x^2 +26x -24)\\
\MoveEqLeft[1] \textcolor{red}{(x-1)(x-2)(x-3)(x-4)}\\
&= x^4 -9x^3 +26x^2 -24x -x^3 +9x^2 -26x +24 \\
\MoveEqLeft[1] \textcolor{red}{(x-1)(x-2)(x-3)(x-4)}\\
&= x^4 -10x^3 +35x^2 -50x  +24 
\end{align*}

Simplified version:
\begin{align*}
\MoveEqLeft[1] (x-1)(x-2)(x-3)(x-4)\\
&= (x-1) (x-2) (x^2 -4x -3x +12)\\
&= (x-1) (x-2) (x^2 -7x +12)\\
&= (x-1) (x^3 -7x^2 +12x -2x^2 +14x -24)\\
&= (x-1) (x^3 -9x^2 +26x -24)\\
&= x^4 -9x^3 +26x^2 -24x -x^3 +9x^2 -26x +24 \\
&= x^4 -10x^3 +35x^2 -50x  +24 
\end{align*}

\end{document}

在此处输入图片描述

答案2

看看下面是否是您想要的:

\documentclass[12pt]{article}
\usepackage{mathtools}
\usepackage[a6paper,hmargin=5mm,bottom=13mm,top=5mm]{geometry}
\usepackage{xcolor}
\parindent=0pt\relax

\begin{document}
\textbf{Question}:\\
Expand $(x-1)(x-2)(x-3)(x-4)$.

\textbf{Answer}:
\begin{align*}
&(x-1)(x-2)(x-3)(x-4)\\
&\quad = (x-1) (x-2) (x^2 -4x -3x +12)\\
&{\color{red}(x-1)(x-2)(x-3)(x-4)}\\
&\quad = (x-1) (x-2) (x^2 -7x +12)\\
&{\color{red}(x-1)(x-2)(x-3)(x-4)}\\
&\quad = (x-1) (x^3 -7x^2 +12x -2x^2 +14x -24)\\
&{\color{red}(x-1)(x-2)(x-3)(x-4)}\\
&\quad = (x-1) (x^3 -9x^2 +26x -24)\\
&{\color{red}(x-1)(x-2)(x-3)(x-4)}\\
&\quad = x^4 -9x^3 +26x^2 -24x -x^3 +9x^2 -26x +24 \\
&{\color{red}(x-1)(x-2)(x-3)(x-4)}\\
&\quad = x^4 -10x^3 +35x^2 -50x  +24
\end{align*}
\newpage

Simplified version:
\begin{align*}
    \MoveEqLeft
(x-1)(x-2)(x-3)(x-4)\\
    &= (x-1) (x-2) (x^2 -4x -3x +12)\\
    &= (x-1) (x-2) (x^2 -7x +12)\\
    &= (x-1) (x^3 -7x^2 +12x -2x^2 +14x -24)\\
    &= (x-1) (x^3 -9x^2 +26x -24)\\
    &= x^4 -9x^3 +26x^2 -24x -x^3 +9x^2 -26x +24 \\
    &= x^4 -10x^3 +35x^2 -50x  +24
\end{align*}

\end{document}

在此处输入图片描述

在此处输入图片描述

相关内容