如何协调系统

如何协调系统

我很难将文本和方程式对齐。我不知道该使用哪个包。抱歉,我列出代码的方式不是最好的。这是我第一次进入这个论坛。这是我最终的 pdf 的图片:

在此处输入图片描述

以下是我针对该图片编写的代码:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{enumerate}
\item{
\begin{equation}
\begin{aligned}
 & x-2x+4-6x                                                    \\
 & = x-2x-6x+4           & \text{Rearrange the terms}           \\
 & = -x-6x+4             & \text{Subtraction (for x)} \nonumber \\
 & = -7x+4               & \text{Subtraction (for x)}
\end{aligned}   
\end{equation}}

\item{
\begin{equation}
\begin{aligned}    
 & 2x-5(5+2)^2+3x                                               \\
 & = 2x+3x - 5(5+2)^2    & \text{Rearrange the terms}           \\
 & = 5x-5(5+2)^2         & \text{Addition (for x)}              \\
 & = 5x-5(7)^2           & \text{Parantheses} \nonumber         \\
 & = 5x - 5(49)          & \text{Exponent}                      \\
 & = 5x - 245            & \text{Multiplication}
\end{aligned}    
\end{equation}}

\item{
\begin{equation}
\begin{aligned}    
 & 6x+5x+11x+12+14x                                             \\
 & = 6x+5x+11x+14x+12    & \text{Rearrange the terms}           \\
 & = 11x+11x+14x+12      & \text{Addition (for x)}              \\
 & = 22x + 14x +12       & \text{Addition (for x)}              \\
 & = 36x +12             & \text{Addition (for x)} \nonumber    \\
\end{aligned}    
\end{equation}}

\item{
\begin{equation}
\begin{aligned}   
 & 5+12+5x-15x+10                                               \\
 & = 5x-15x+5+12+10      & \text{Rearrange the terms}           \\
 & = -10x+5+12+10        & \text{Subtraction (for x)}           \\
 & = -10x+17+10          & \text{Addition}                      \\
 & = -10x+27             & \text{Addition} \nonumber            \\
\end{aligned}    
\end{equation}}

\end{enumerate}
\end{document}

答案1

如果您想要延续对齐,最简单的方法是定义您自己的环境:

\documentclass{article}
\usepackage[pass,showframe]{geometry} % just to show the page margins
\usepackage{amsmath}

\makeatletter
\newenvironment{multialign} % a copy of flalign*
  {\setcounter{multialign}{0}%
   \def\item{\refstepcounter{multialign}\themultialign.\qquad}%
   \start@align\tw@\st@rredtrue\m@ne}
  {\endalign}
\makeatother
\newcounter{multialign}
\allowdisplaybreaks

\begin{document}

\begin{multialign}
\item
 & x-2x+4-6x             &                              && \\
 & = x-2x-6x+4           & \text{Rearrange the terms}   && \\
 & = -x-6x+4             & \text{Subtraction (for $x$)} && \\
 & = -7x+4               & \text{Subtraction (for $x$)} && \\
\item 
 & 2x-5(5+2)^2+3x        &                              && \\
 & = 2x+3x - 5(5+2)^2    & \text{Rearrange the terms}   && \\
 & = 5x-5(5+2)^2         & \text{Addition (for $x$)}    && \\
 & = 5x-5(7)^2           & \text{Parantheses}           && \\
 & = 5x - 5(49)          & \text{Exponent}              && \\
 & = 5x - 245            & \text{Multiplication}        && \\
\item 
 & 6x+5x+11x+12+14x      &                              && \\
 & = 6x+5x+11x+14x+12    & \text{Rearrange the terms}   && \\
 & = 11x+11x+14x+12      & \text{Addition (for $x$)}    && \\
 & = 22x + 14x +12       & \text{Addition (for $x$)}    && \\
 & = 36x +12             & \text{Addition (for $x$)}    && \\
\item 
 & 5+12+5x-15x+10        &                              && \\
 & = 5x-15x+5+12+10      & \text{Rearrange the terms}   && \\
 & = -10x+5+12+10        & \text{Subtraction (for $x$)} && \\
 & = -10x+17+10          & \text{Addition}              && \\
 & = -10x+27             & \text{Addition}              &&
\end{multialign}

\end{document}

在此处输入图片描述

答案2

\documentclass[preview,border=12pt,12pt]{standalone} % disable this line and change to the article below.
%\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{enumitem}
\setlist[enumerate,1]{itemsep=12pt,label=\textbf{\arabic*.},start=9}
\begin{document}
\begin{enumerate}
% One ----------------
\item
$\!
\begin{aligned}[t]
x-2x+4-6x 
&= x-2x-6x+4 && \text{Rearrange the terms} \\
&= -x-6x+4 && \text{Subtraction (for $x$)}  \\
&= -7x+4 &&  \text{Subtraction (for $x$)}
\end{aligned}
$

% Two ----------------
\item
$\!
\begin{aligned}[t]
x-2x+4-6x 
&= x-2x-6x+4 && \text{Rearrange the terms} \\
&= -x-6x+4 && \text{Subtraction (for $x$)}  \\
&= -7x+4 &&  \text{Subtraction (for $x$)}
\end{aligned}
$

\end{enumerate}
\end{document}

在此处输入图片描述

相关内容