ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: \startalign and "underline"
Date: Tue, 13 Feb 2007 11:20:16 -0500 (EST)	[thread overview]
Message-ID: <alpine.WNT.0.82.0702131113000.3160@nqvgln> (raw)
In-Reply-To: <6faad9f00702130454h4a0ca6e9tadb6f805e63bb52e@mail.gmail.com>

On Tue, 13 Feb 2007, Mojca Miklavec wrote:

> Hello,
>
> is there a nice way to [mis]use \startalign or combine it with
> something else to typeset equations like the following one (in a
> fixed-width font)?

fixed-width font? Then you can just use \starttable with appropriate 
setting for distance. Even otherwise you can use starttable with |m| 
columns, but I understant math align better.

>
>   a + b =  9
>   a - b =  3
>  ___________
>  2a     = 12

\noalign is your friend. Here is the first approximation

\starttext

\startformula \startalign[n=5]
   \NC a  \NC + \NC b \NC = \NC 9  \NR
   \NC a  \NC - \NC b \NC = \NC 3  \NR
\noalign{\hrule}
   \NC 2a \NC   \NC   \NC = \NC 12 \NR
\stopalign \stopformula

\stoptext

Hmm... the width of the rule is too long, so lets use something with a 
fixed width

\starttext

\startformula \startmatrix[n=5]
   \NC a  \NC + \NC b \NC = \NC 9  \NR
   \NC a  \NC - \NC b \NC = \NC 3  \NR
\noalign{\hrule}
   \NC 2a \NC   \NC   \NC = \NC 12 \NR
\stopmatrix \stopformula

\stoptext

Hmm... distance and alignment are wrong, so lets correct that

\starttext

\startformula

\startmatrix[n=5,distance=.3em,align={right,middle,right,middle,right}]
   \NC a  \NC + \NC b \NC = \NC 9  \NR
   \NC a  \NC - \NC b \NC = \NC 3  \NR
\noalign{\hrule}
   \NC 2a \NC   \NC   \NC = \NC 12 \NR
\stopmatrix \stopformula

\stoptext

Voila! I did not know that ConTeXt math alignment macros could do 
something like this.

Aditya

  reply	other threads:[~2007-02-13 16:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-13 12:54 Mojca Miklavec
2007-02-13 16:20 ` Aditya Mahajan [this message]
2007-02-13 16:53   ` Mojca Miklavec

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=alpine.WNT.0.82.0702131113000.3160@nqvgln \
    --to=adityam@umich.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).