2

I can't seem to align the numberings on my equations. If anyone can help that would great! Here are my codes:

\begin{multialign}

\item 

4x - 2 &< 3 && \\

4x - 2 + 2 &< 3+2 &\text{Add 2 to both side} && \\

4x &< 5 & \text{Simplify} && \\

\frac{4x}{4} &< \frac{5}{4} & \text{Divide both side by 4} && \\

x &< \frac{5}{4} &\text{Simplify} && \\

\item 

5(x+2) &\geq 6 && \\

\frac{5(x+2)}{5} &\geq \frac{6}{5} &\text{Divide both side by 5} && \\

x+2 &\geq \frac{6}{5} &\text{Simplify} && \\

x+2-2 &\geq \frac{6}{5}-2 &\text{Subtract 2 from both side} && \\

x &\geq - \frac{2}{5} &\text{Simplify} && \\

\item 

6x &> 3 && \\

\frac{6x}{6} &> \frac{3}{6} &\text{Divide both side by 6} && \\

x &> \frac{1}{2} &\text{Simplify} &&\\

\item 

10(x+15)+20 &> 10 && \\

10(x+15) +20-20 &> 10-20 &\text{Subtract 20 from both side} && \\

10(x+15) &> -10 &\text{Simplify} && \\

\frac{10(x+15)}{10} &> \frac{-10}{10} &\text{Divide both side by 10} && \\

x+15 &> -1 &\text{Simplify} &&\\

x+15-15 &> -1-15 &\text{Subtract 15 from both side} &&\\

x &> =16 &\text{Simplify} && \\

\item 

\frac{x}{5}+14 &\leq 20 && \\

5\frac{x}{5}+14 &\leq 20(5) &\text{Multiply 5 to both side} && \\

x+14 &\leq 100 &\text{Simplify} && \\

x+14-14 &\leq 100-14 &\text{Subtract 14 from both side} && \\

x &\leq 86 &\text{Simplify} && \\

\end{multialign}

Here's a picture of what I mean. The numberings are not aligned. enter image description here


So I tweaked @JPi's help a little bit and it came out perfectly fine. One last add-on question is that does this write up looks clean enough to read through?enter image description here

Heiko Oberdiek
  • 271,626
Gamerdue
  • 183

1 Answers1

4

Thanks to https://tex.stackexchange.com/users/31729/christian-hupfer 's link the following code fixes your problem. It appears that Egreg's solution requires ampersands at the start of each line.

\documentclass{article}
\usepackage{mathtools}
\newcounter{multialign}
\makeatletter
%% see https://tex.stackexchange.com/a/191379/5001 for the original definition of multialign
\newenvironment{multialign} 
  {%%\setcounter{multialign}{0}%
   \def\item{\refstepcounter{multialign}\themultialign.\qquad}%
   \start@align\tw@\st@rredtrue\m@ne}
  {\endalign}
\newcommand{\firstmaline}[1]{%
  \kern-1em \mathrlap{#1}\kern5cm}
\makeatother
\allowdisplaybreaks

\begin{document}

\begin{multialign}
\item 
&4x - 2 &< 3 && \\
&4x - 2 + 2 &< 3+2 &\text{Add 2 to both side} && \\
&4x &< 5 & \text{Simplify} && \\
&\frac{4x}{4} &< \frac{5}{4} & \text{Divide both side by 4} && \\
&x &< \frac{5}{4} &\text{Simplify} && \\
\item 
&5(x+2) &\geq 6 && \\
&\frac{5(x+2)}{5} &\geq \frac{6}{5} &\text{Divide both side by 5} && \\
&x+2 &\geq \frac{6}{5} &\text{Simplify} && \\
&x+2-2 &\geq \frac{6}{5}-2 &\text{Subtract 2 from both side} && \\
&x &\geq - \frac{2}{5} &\text{Simplify} && \\
\item 
&6x &> 3 && \\
&\frac{6x}{6} &> \frac{3}{6} &\text{Divide both side by 6} && \\
&x &> \frac{1}{2} &\text{Simplify} &&\\
\item 
&10(x+15)+20 &> 10 && \\
&10(x+15) +20-20 &> 10-20 &\text{Subtract 20 from both side} && \\
&10(x+15) &> -10 &\text{Simplify} && \\
&\frac{10(x+15)}{10} &> \frac{-10}{10} &\text{Divide both side by 10} && \\
&x+15 &> -1 &\text{Simplify} &&\\
&x+15-15 &> -1-15 &\text{Subtract 15 from both side} &&\\
&x &> =16 &\text{Simplify} && \\
\item 
&\frac{x}{5}+14 &\leq 20 && \\
&5\frac{x}{5}+14 &\leq 20(5) &\text{Multiply 5 to both side} && \\
&x+14 &\leq 100 &\text{Simplify} && \\
&x+14-14 &\leq 100-14 &\text{Subtract 14 from both side} && \\
&x &\leq 86 &\text{Simplify} && \\
\end{multialign}

\end{document}
JPi
  • 13,595