## LaTeX forum ⇒ Math & Science ⇒ Best Formatting for Equation Example Topic is solved

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
tpa77l3
Posts: 19
Joined: Mon Feb 24, 2020 9:49 pm

### Best Formatting for Equation Example

Hi guys,

Newbite queestion; what would be the best way to display the following? I'm after the alignment bewteen the wording and the equations to be the same as shown along with the vertical alignment between the new lines.

Screenshot 2020-04-12 at 05.25.19.png (58.64 KiB) Viewed 1580 times

Many thanks.

tpa77l3
Posts: 19
Joined: Mon Feb 24, 2020 9:49 pm
This is the best that I've managed to come up with so far, but it does left justify the text:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
\begin{align*}	\text{The equation is:}\hspace{10mm}&9a-4=14+3a\\	\text{Subtract $3a$:}\hspace{10mm}&6a-4=14\\	\text{Subtract 4:}\hspace{10mm}&6a=18\\	\text{Divide by 6:}\hspace{10mm}&a=3\end{align*}

Gives:

Screenshot 2020-04-13 at 04.52.01.png (16.11 KiB) Viewed 1544 times

Bartman
Posts: 150
Joined: Fri Jan 03, 2020 2:39 pm
Unfortunately, the example is incomplete again.

I chose the alignat environment because I could not reduce the horizontal distance in the align environment. Manually increasing the distance in the alignat environment may be trickery, but it works.

It could also be implemented with a tabular or array environment, but then the line spacing would have to be increased.

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
\documentclass{article}\usepackage{mathtools}% loads amsmath \begin{document}\begin{align*}    &\text{The equation is:} && 9a-4 = 14+3a\\    &\text{Subtract $3a$:} && 6a-4=14\\    &\text{Subtract 4:} && 6a=18\\    &\text{Divide by 6:} && a=3\end{align*} \begin{alignat*}{2}    &\text{The equation is:}\qquad && 9a-4 = 14+3a\\    &\text{Subtract $3a$:} && 6a-4=14\\    &\text{Subtract 4:} && 6a=18\\    &\text{Divide by 6:} && a=3\end{alignat*} % I prefer the alignment at the equal sign.\begin{alignat*}{2}    &\text{The equation is:}\qquad & 9a-4 &= 14+3a\\    &\text{Subtract $3a$:} & 6a-4 &= 14\\    &\text{Subtract 4:} & 6a &= 18\\    &\text{Divide by 6:} & a &= 3\end{alignat*}\end{document}

tpa77l3
Posts: 19
Joined: Mon Feb 24, 2020 9:49 pm
Sorry about the incomplete example again! Will remember for next time.

These are great thanks. Learning about alignnat and use of && has helped.

Return to “Math & Science”

### Who is online

Users browsing this forum: No registered users and 5 guests