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.
Many thanks.
LaTeX forum ⇒ Math & Science ⇒ Best Formatting for Equation Example Topic is solved
This is the best that I've managed to come up with so far, but it does left justify the text:
Gives:
\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:
Unfortunately, the example is incomplete again.
I chose the
It could also be implemented with a
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.
\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}
Sorry about the incomplete example again! Will remember for next time.
These are great thanks. Learning about
These are great thanks. Learning about
alignnat
and use of &&
has helped.Who is online
Users browsing this forum: No registered users and 2 guests