How can I add such descriptions next to the successive aligned equations using LaTeX?
4 Answers
I think it's better to use an alignat
or alignat*
environment rather than an array
environment to display several rows of equations, for two reasons. First, the rows are spaced slightly farther apart than if an array
environment is used. Second, the material is typeset in display-style math mode by default -- which is appropriate for displayed equations.
\documentclass{article}
\usepackage{amsmath} % for 'alignat*' env.
\usepackage{newtxtext,newtxmath} % Times Roman text and math fonts
\begin{document}
\begin{alignat*}{2}
A+(B+C)
&= [a_{ij}]+[b_{ij}+c_{ij}] &\qquad& \text{by Definition 1.29} \\
&= [a_{ij}+(b_{ij}+c_{ij})] && \text{by Definition 1.29} \\
&= [(a_{ij}+b_{ij})+c_{ij}] && \text{since addition in $\mathbf{R}$ is associative} \\
&= [a_{ij}+b_{ij}]+[c_{ij}] && \text{by Definition 1.29} \\
&= (A+B)+C
\end{alignat*}
\end{document}
With {WithArrows}
of the package witharrows
.
\documentclass{article}
\usepackage{mathtools} % for \MoveEqLeft
\usepackage{witharrows}
\begin{document}
The following equalities establish the associative property for addition.
$\begin{WithArrows}
\MoveEqLeft{A+(B+C)} \Arrow{By definition 1.29} \\
&=\left[a_{ij}\right]+\left[b_{ij}+c_{ij}\right] \Arrow{By definition 1.29}\\
&=\left[a_{ij}+\left(b_{ij}+c_{ij}\right)\right] \Arrow{since addition in $\mathbf R$ is associative}\\
&=\left[\left(a_{ij}+b_{ij}\right)+c_{ij}\right] \Arrow{By definition 1.29}\\
&=\left[a_{ij}+b_{ij}\right]+\left[c_{ij}\right] \Arrow{By definition 1.29} \\
&=(A+B)+C
\end{WithArrows}$
\end{document}
Here's a possibility:
\documentclass{article}
\usepackage{array}
\begin{document}
The following equalities establish the associative property for addition.
\[\begin{array}{r @{} >{{}}c<{{}} @{} ll}
A+(B+C)&=&[a_{ij}]+[b_{ij}+c_{ij}]&\mbox{By definition 1.29}\\
&=&[a_{ij}+(b_{ij}+c_{ij})]&\mbox{By definition 1.29}\\
&=&[(a_{ij}+b_{ij})+c_{ij}]&\mbox{since addition in $\mathbf R$ is associative}\\
&=&[a_{ij}+b_{ij}]+[c_{ij}]&\mbox{By definition 1.29}\\
&=&(A+B)+C&\mbox{By definition 1.29}
\end{array}\]
\end{document}
As starting point is considered @José Carlos Santos answer (+1):
\documentclass{article}
\usepackage{array}
\begin{document}
The following equalities establish the associative property for addition.
\[\renewcommand\arraystretch{1.2}
\begin{array}{r@{\,}c@{\,}l >{\qquad$}l<{$}}
A+(B+C) &=& [a_{ij}] + [b_{ij} + c_{ij}] & by definition 1.29 \\
&=& [a_{ij}+ (b_{ij} + c_{ij})] & by definition 1.29 \\
&=& [(a_{ij}+b_{ij}) + c_{ij}] & since addition in $\mathbf{R}$ is associative\\
&=& [a_{ij}+b_{ij}] + [c_{ij}] & by definition 1.29 \\
&=& (A+B)+C & by definition 1.29
\end{array}
\]
\end{document}