summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/eplain/base/test/mdisplay.tex
blob: 96ed8543b9c133d87784df68f25bf44f1b67d994 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
% This file is public domain.
%
% 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