Math & Science ⇒ equations with right-justified reasons
equations with right-justified reasons
Norm Matloff
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
equations with right-justified reasons
it's preferable not to use eqnarray anymore (read Avoid eqnarray! by Lars Madsen). You could use an align (or an align*) environment:
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
a (b + c) &= ab + ac && \text{(by distributivity)} \\
&= ba + ca && \text{(by commutativity)} \notag\\
&= (b + c)a. && \text{(by distributivity)} \notag
\end{align*}
\end{document}
Re: equations with right-justified reasons
-
- Posts: 351
- Joined: Sat Aug 02, 2008 8:47 am
equations with right-justified reasons
matloff wrote:I'd like to display equations using eqnarray, with reasons shown on the far right. It's straightforward to put in reasons, but I don't see how to right justify them. Is there a way to do this?
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\parindent=0pt
\begin{document}
\rule{\textwidth}{1pt}
\begin{align*}
a (b + c) &= ab + ac \tag*{(by distributivity)} \\
&= ba + ca \tag*{(by commutativity)} \\
&= (b + c)a. \tag*{(by distributivity)}
\end{align*}
\end{document}