10

I am having a hard time of getting my texts and equations aligned. Idk what pack to use. Sorry the way I listed the codes are not the very best. This is my first time going on to this forum. Here's a picture of how my ended pdf look like:

enter image description here

Here are my codes for the picture:

\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}
Pouya
  • 7,269
Gamerdue
  • 183

2 Answers2

7

If you want to carry over the alignment, the easiest way is to define your own environment:

\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}

enter image description here

egreg
  • 1,121,712
  • perhaps i'm being overly fussy, but i think the first line of each item should stand out a little more; in other words, i'd like to see the equal signs (still aligned) just a bit more to the right. – barbara beeton Jul 14 '14 at 14:11
  • @barbarabeeton I've no clear idea of what would be better. – egreg Jul 14 '14 at 15:14
  • Hi there, this is what i really wanted my thing to look like. – Gamerdue Jul 14 '14 at 19:07
  • Hey I tried out this method and I still get the same thing. Is it possible if you can look at my code and see what's wrong with them. Here's the link to my sharelatex file.https://www.sharelatex.com/project/53c42d51fcd24bc9623a4b24?r=7414bb3c&rs=ps&rm=d – Gamerdue Jul 14 '14 at 19:21
  • @user162517 You're simply not using the same code as I used. You can't use equation inside multialign. – egreg Jul 14 '14 at 19:26
  • Wait so I deletion my \begin{equation} and use your code? – Gamerdue Jul 14 '14 at 19:31
  • 1
    @Gamerdue That's the idea: you don't see equation and aligned in my code, do you? ;-) – egreg Jul 14 '14 at 19:33
1
\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}

enter image description here

  • 1
    Your answer does not work if you replace the second item with and equation of different width (e.g. replace it with the OP's fourth item in the mwe). – Pouya Jul 14 '14 at 10:54