From: Aditya Mahajan <adityam@umich.edu>
Cc: Context Mailing List List <ntg-context@ntg.nl>,
Bruce Wagner <bruce-wagner@redwoods.edu>
Subject: Re: Align with comments
Date: Thu, 4 May 2006 02:44:32 -0400 (EDT) [thread overview]
Message-ID: <Pine.WNT.4.63.0605040226480.2184@nqvgln> (raw)
In-Reply-To: <C43B8C03-0A5B-436E-AAAA-BDAC7DF35C67@cox.net>
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
prev parent reply other threads:[~2006-05-04 6:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-04 4:56 David Arnold
2006-05-04 6:44 ` Aditya Mahajan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.WNT.4.63.0605040226480.2184@nqvgln \
--to=adityam@umich.edu \
--cc=bruce-wagner@redwoods.edu \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).