% Test math displays.
% 
\ifx\undefined\eplain \input eplain \fi

%\loggingall

A simple one, done with plain, for comparison (it should come out
centered).  Because of the way that \TeX's modes work, you should never
leave a blank line (i.e., cause a par command) before a display.  When
\TeX\ sees a \$ in vertical mode, it switches to horizontal mode; but
then when the display starts, it goes back to vertical mode, thus
causing an extraneous blank line before the display.  (Plain \TeX\ sets
abovedisplayskip to about a baselineskip, so you are going to get one
blank line from that (unless the line above the display is short, in
which case aboveshortdisplayskip is used, which is 3pt or some such);
but if a par intervenes between the end of the paragraph and the
beginning of the display, you get a second one.)
$$x = y + z$$

After a centereddisplays:
\centereddisplays
$$d+e+f$$

Now starting leftdisplays.
\leftdisplays

No equation number:
$$A = B + C$$

Do another leftdisplays.
\leftdisplays
$$a+n=m$$

Equation number on right:
$$D = E + F\eqno (r)$$

Equation number on left:
$$G = H + I\leqno (l)$$

Using eqdef:
$$J = K + L\eqdef{hello}$$

Here is one done with displaylines:
$$\displaylines{x=1\cr}$$

Let's do those again, indented by one inch plus the paragraph indentation:
{\leftdisplayindent = 1in
  No equation number:
  $$A = B + C$$

  Equation number on right:
  $$D = E + F\eqno (r)$$

  Equation number on left:
  $$G = H + I\leqno (l)$$

  Using eqdef:
  $$J = K + L\eqdef{hello}$$

  Here is one done with displaylines:
  $$\displaylines{x=1\cr}$$
}

\hrule
\smallskip
The rule above just makes it easier to see the margins.

Another displaylines, this one should end up on the right.
$$\displaylines{\hfill y=2\cr}$$

A displaylines with an eqno:
$$\displaylines{x=1 \eqno{d}\cr}$$

A displaylines with an eqdef:
$$\displaylines{x=1 \eqdef{eqdef-displ}\cr}$$

{\leftskip = 14pt
An indented displaylines with an eqdef:
$$\displaylines{x=1 \eqdef{eqdef-displ}\cr}$$

}

Here is one with done with eqalign (the ='s should line up):
$$\eqalign{
   a+b&=c\cr
   dq+er&=f\cr
}$$

An eqalign with a noalign inside:
$$\eqalign{
   a+b&=c\cr
   g+h&=i\cr
}$$

And one with eqalignno:
$$\eqalignno{
   a+b&=c&(1)\cr
   d+e&=f&(1*)\cr
   g+h&=i&\eqdef{eqdef-2}\cr
}$$

An eqalignno with a noalign inside:
$$\eqalignno{
   a+b&=c&(1)\cr
\noalign{and}
   g+h&=i&\eqdef{eqdef-2}\cr
}$$

And one (indented more) with leqalignno:
{\leftdisplayindent = 1in
$$\leqalignno{
   a+b&=c&(1)\cr
   dt+eg&=f&(1*)\cr
   g+h&=i&\eqdef{eqdef-3}\cr
}$$
}

A cases, from p.175 of the TeXbook.
$$
  |x| = \cases{x,  &if $x\ge0$;\cr
               -x, &otherwise.\cr
}$$

A pmatrix, from p.176.
$$\pmatrix{
  x-\lambda&1&0\cr
  0&x-\lambda&1\cr
  0&0&x-\lambda\cr
}$$


The rule below just makes it easier to see the margins.
\smallskip
\hrule
\bigskip

Back to centered displays now.
\centereddisplays

No equation number:
$$A = B + C$$

Equation number on right:
$$D = E + F\eqno (r)$$

Equation number on left:
$$G = H + I\leqno (l)$$

Using eqdef:
$$J = K + L\eqdef{hello}$$

Here is one done with displaylines:
$$\displaylines{x=1\cr}$$

\hrule
\smallskip
The rule above just makes it easier to see the margins.

Another displaylines, this one should end up on the right.
$$\displaylines{\hfill y=2\cr}$$

Here is one with done with eqalign (the ='s should line up):
$$\eqalign{
   a+b&=c\cr
   dq+er&=f\cr
}$$

And one with eqalignno:
$$\eqalignno{
   a+b&=c&(1)\cr
   d+e&=f&(1*)\cr
   g+h&=i&\eqdef{eqdef-2}\cr
}$$

An eqalignno with a noalign inside:
$$\eqalignno{
   a+b&=c&(1)\cr
\noalign{and}
   g+h&=i&\eqdef{eqdef-2}\cr
}$$

And one (indented more) with leqalignno:
{\leftdisplayindent = 1in
$$\leqalignno{
   a+b&=c&(1)\cr
   dt+eg&=f&(1*)\cr
   g+h&=i&\eqdef{eqdef-3}\cr
}$$
}

The rule below just makes it easier to see the margins.
\smallskip
\hrule
\bigskip


A cases, from p.175 of the TeXbook.
$$
  |x| = \cases{x,  &if $x\ge0$;\cr
               -x, &otherwise.\cr
}$$

A pmatrix, from p.176.
$$\pmatrix{
  x-\lambda&1&0\cr
  0&x-\lambda&1\cr
  0&0&x-\lambda\cr
}$$

Now after a second centereddisplays:
\centereddisplays
$$a + b = c$$
\end
