[NTG-context] A couple more suggestions for m-newmat.

Brooks Moses bmoses at stanford.edu
Sun Jul 31 10:50:26 CEST 2005


While I'm thinking about it, here are a couple more things from LaTeX's 
math stuff that might be useful to include in m-newmat:

The \stackrel command is listed as "a disguise for plain TeX's \buildrel", 
much like \frac is a "disguise" for \over:

   \def\stackrel#1#2{\mathrel{\mathop{#2}\limits^{#1}}}

There's also the \lefteqn command:

   \def\lefteqn#1{\rlap{$\displaystyle #1$}}

The \lefteqn command is useful for doing partly-aligned equations, of the 
sort that get displayed as:

       long left-hand-side
           = long right-hand-side part 1
             + long right-hand-side part 2
             + long right-hand-side part 3

Essentially, you'd write that in an eqalign (or something like it), as:

   \placeformula
   \startformula
   \eqalign{%
     \lefteqn{long left-hand-side}\qquad & \cr
         &= long right-hand-side part 1 \cr
         &\quad {}+ long right-hand-side part 2 \cr
         &\quad {}+ long right-hand-side part 3 \cr
   }
   \stopformula

As can be seen, \lefteqn lets the long left-hand-side overlap the alignment 
point, without shifting it excessively to the right.  It's not perfect -- 
for one thing, if the left-hand-side extends farther to the right than the 
right-hand-sides, the equation won't be centered -- but it's a good start 
and works right most of the time.  :)

- Brooks



More information about the ntg-context mailing list