* Align with comments
@ 2006-05-04 4:56 David Arnold
2006-05-04 6:44 ` Aditya Mahajan
0 siblings, 1 reply; 2+ messages in thread
From: David Arnold @ 2006-05-04 4:56 UTC (permalink / raw)
Cc: Bruce Wagner
Aditya,
I think a while back you provided an align example with comments,
such as:
2x+3=5 Add -3 to both sides
2x+3-3=5-3 Simplify
2x=2 Divide both sides by 2
Etc.
Could you provide another sample of this for us?
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Align with comments
2006-05-04 4:56 Align with comments David Arnold
@ 2006-05-04 6:44 ` Aditya Mahajan
0 siblings, 0 replies; 2+ messages in thread
From: Aditya Mahajan @ 2006-05-04 6:44 UTC (permalink / raw)
Cc: Context Mailing List List, Bruce Wagner
Hi David,
On Wed, 3 May 2006, David Arnold wrote:
> I think a while back you provided an align example with comments, such as:
>
> 2x+3=5 Add -3 to both sides
> 2x+3-3=5-3 Simplify
> 2x=2 Divide both sides by 2
>
> Etc.
>
> Could you provide another sample of this for us?
Assuming that you want to align at the = in the equations, you can use
the following
\startformula \startalign[m=2,distance=4em]
\NC 2x + 3 \NC = 5 \NC\NC \text{Add -3 to both sides} \NR
\NC 2x + 3 - 3 \NC = 5 - 3 \NC\NC \text{Simplify} \NR
\NC 2x \NC = 2 \NC\NC \text{Divide both sides by 2} \NR
\stopalign \stopformula
If you use this kind of thing frequently, you can add some
syntax sugar.
\definemathalignment
[aligncomments]
[m=2,distance=4em]
\def\Comment#1\NR{\NC\NC\text{#1}\NR}
\startformula \startaligncomments
\NC 2x + 3 \NC = 5 \Comment Add -3 to both sides \NR
\NC 2x + 3 - 3 \NC = 5 - 3 \Comment Simplify \NR
\NC 2x \NC = 2 \Comment Divide both sides by 2 \NR
\stopaligncomments \stopformula
If you simply want to left align the equations, you can use
\definemathalignment
[aligncomments]
[n=1,align={left},m=2,distance=4em]
\def\Comment#1\NR{\NC\text{#1}\NR}
\startformula \startaligncomments
\NC 2x + 3 = 5 \Comment Add -3 to both sides \NR
\NC 2x + 3 - 3 = 5 - 3 \Comment Simplify \NR
\NC 2x = 2 \Comment Divide both sides by 2 \NR
\stopaligncomments \stopformula
Aditya
--
Aditya Mahajan, EECS Systems, University of Michigan
http://www.eecs.umich.edu/~adityam || Ph: 7342624008
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-05-04 6:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-04 4:56 Align with comments David Arnold
2006-05-04 6:44 ` Aditya Mahajan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).