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

7
  • A tip: If you indent lines by 4 spaces or enclose words in backticks `, they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it). Please post always a MWE to help us to help you
    – user31729
    Commented Aug 7, 2014 at 22:15
  • What is this multialign environment?
    – Bernard
    Commented Aug 7, 2014 at 22:34
  • 1
    @Bernard: See the (related?) question tex.stackexchange.com/questions/191510/latex-alignment. It's from no package at all
    – user31729
    Commented Aug 7, 2014 at 22:35
  • multialign is something I learned it from a previous question I asked on here.
    – Gamerdue
    Commented Aug 8, 2014 at 3:24
  • @Gamerdue You learned it wrong. ;-) An initial ampersand is required.
    – egreg
    Commented Aug 8, 2014 at 9:49

1 Answer 1

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .