summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/otherformats/texsis/base/TXSeqns.doc
blob: d7c0e43aa908cf2d856710cb97c0d656daf47737 (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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
%% file: TXSeqns.doc - Equations - TeXsis version 2.18
%% @(#) $Id: TXSeqns.doc,v 18.2 2000/05/17 00:19:46 myers Exp $
%======================================================================*
% (C) Copyright 1989, 1992 by Eric Myers and Frank E. Paige
% This file is a part of TeXsis.  Distribution and/or modifications
% are allowed under the terms of the LaTeX Project Public License (LPPL).
% See the file COPYING or ftp://ftp.texsis.org/texsis/LPPL
%======================================================================*
\ifx\undefined\meta\texsis\input TXSdocM.doc\draft\fi

\section{Equations              \label{sect.eqns}}

Plain \TeX\  was designed to make it easy to typeset equations
and mathematical formulae.  \TeXsis\  provides additional features
that make the job even easier.  Among these are the automatic
numbering of equations (with the ability to refer to numbered equations
by symbolic labels), automatic sizing of parentheses, and a
collection of special symbols which are often used by physicists.

\subsection{Equation Numbering          \label{sect.eqno}}%
In Plain \TeX\  equation numbers are added to displayed
equations with the \cs{eqno} command, as described in Chapter~19 of
\TeXbook.  For example, typing
\index{equations!numbering}
\TeXexample
$$ E=mc^2.  \eqno (47) $$
|endTeXexample
will produce
\offparens
$$
E = mc^2   \eqno (47)
$$
With \TeXsis\  the procedure for getting
automatically numbered equations is similar, except that you use
\CS{EQN} instead of \cs{eqno}, and what follows this (up to the
``|$$|'') is not used as the number of the equation, but as an
internal {\it label}\, for the equation.  For example, if you had
already used |\EQN| to create three numbered equations, then
typing
\eqnum=3
\TeXexample
$$ \vec F = -{G_N Mm \over r^2} \, \hat r
   \EQN Newton $$
|endTeXexample
would produce
$$
\vec F = -{G_N Mm \over r^2} \, \hat r 
   \EQN Newton
$$
\TeXsis\  automatically assigns the next available equation number to
the equation and prints this number on the right, in parentheses.
The equations that follow the one above would be numbered 4.5,
4.6, and so on.

   The purpose of the "label" after the |\EQN| is to let you
refer to the equation in the text without knowing the equation
number that has been assigned to it.  For example, to refer to
\Eq{Newton} above, which has the label ``Newton'', you might type
\index{equations!labeling}
\TeXexample
The dependence of the force on the inverse square of the distance 
can be seen in \Eq{Newton}.
|endTeXexample
This would be printed as:  
\example 
The dependence of the force on the inverse square of the distance
can be seen in \Eq{Newton}.
\endexample   
The control sequence \CS{Eq}\arg{label} gives the same result
as typing "|Eq.~(|$nn$|)|", where $nn$ is the appropriate
equation number for the given label.  Two similar control
words allow you to refer to a range of equations, or to refer to
an equation simply by number, without the preceding "|Eq.~|."
Typing \CS{Eqs}\arg{label} produces "Eqs.~($nn$)", while
\CS{Ep}\arg{label} gives just the equation number associated
with the label, enclosed in parentheses. Thus typing
\TeXexample
The class of metrics defined by \Eqs{cond-1} through 
\Ep{cond-5} can all be shown to satisfy inequality
\Ep{triangle}, as well as the condition in \Eq{Killing}.
|endTeXexample
would produce output something like
\example
The class of metrics defined by Eqs.~(14) through 
(19) can all be shown to satisfy inequality
(23), as well as the condition in Eq.~(7).
\endexample
  
   Almost any sequence of characters can be used as a "label" for
an equation.  This includes letters, numbers, and punctuation
marks, but it is best to avoid \TeX's special characters, such as
|\|, |&|, |}|, |{|, |$|, |_|, and |^|.  Spaces may be included
but will be ignored, and there {\sl is} a difference between
uppercase and lowercase letters.  Also, the semicolon (|;|) is
reserved for a special purpose, which is described below.

   You may want to give equations "names," as in the example
called "Newton" above, or you can give the equations labels that
are numbers.  This is the best thing to do if the equations in
the original manuscript already have numbers, but if you do this
then you should be sure to remember that the internal label and
the number which is printed (the ``external'' number) are not
necessarily the same.  If the equation {\it labeled} ``15'' is
the fifteenth equation in the document then it will also be
equation number 15, but if you move the equation around in the
file so that it is the sixth equation in the document it will be
printed as equation 6, even though it has the label ``15''.

   If you have a heavily edited document and the arrangement of
the numbers and labels gets confusing there is a useful aid to
help straighten things out.  If you say
\example
\CS{eqnotracetrue}
\endexample                     
then the equation numbers will be printed as usual, but with the label
appearing next to it in the right margin in square brackets.
For example, the equation
\TeXexample   
$$         
(i\gamma^\mu \partial_\mu - m)\psi (x) = 0
   \EQN Dirac $$
|endTeXexample
when printed with |\eqnotracetrue| would appear as:
\begingroup\eqnotracetrue
$$       
(i\gamma^\mu \partial_\mu - m)\psi (x) = 0
\EQN Dirac$$
\endgroup
Since the label appears in the margin the spacing of your document
remains exactly the same.
Obviously you would not print the final copy of the document this way,
but it can be very useful for editing.  You can turn off this
equation tracing feature anytime by saying \cs{eqnotracefalse}.  If you
say \cs{draft} at the beginning of your document then the equation
tracing will be turned on automatically (along with some other useful
features).
\index{equations!labeling}

\bigskip
  
        Sometimes when several equations are closely related you will
want to give the whole set the same equation number.  To distinguish
separate formulae in such a group you then generally add a letter to
the number.  You might, for example, have the equation
\index{equations!multiple}
$$
J^2\ket{j,m} = j(j+1) \ket{j,m} \EQN eigen;a 
$$
and then a short while later you might have the related equation
$$
J_z\ket{j,m} = m \ket{j,m} \EQN eigen;b
$$
These may be referred to together as \Eqs{eigen} or may be
referred to separately as \Eqs{eigen;a} and \Ep{eigen;b}. To get
an equation number with a letter in it you still use \CS{EQN}, but
you add the appropriate letter to the end of the label, separated
{from} the label by a semicolon.  The equations above were created
by typing:
\TeXexample
$$
J^2\ket{j,m} = j(j+1) \ket{j,m} \EQN eigen;a
$$
|endTeXexample
and 
\TeXexample
$$
J_z\ket{j,m} = m \ket{j,m} \EQN eigen;b
$$
|endTeXexample
The semicolon is not printed --- it is just used to separate the
letter from the label.  If the letter is ``a'' then the next
available equation number is used, as usual, but if the letter is
anything else then the equation number is not incremented and
instead the number from the previous equation is used.  You can
use any sequence of letters you like, although it is usually best
to use ``a,b,c$\ldots$'' for consecutive equations.
                                                      
   To refer to equations that have both numbers and letters you
can either use the letter to pick out a specific equation, or
simply leave out the letter and use the label to refer to the
whole set together.  You can use either \CS{Eq} or \CS{Eqs} to do
this.  For example, the sentence after \Eq{eigen;b} above was
created by typing
\TeXexample                                           
These may be referred to together as \Eqs{eigen}
or may be referred to separately as 
\Eqs{eigen;a} and \Ep{eigen;b}.
|endTeXexample    
\index{equations!multiple}

\bigskip
                  
   You will eventually encounter an equation that is so long that
it has to be broken up into several lines, or you will want to
print several equations together, lined up by their "$=$" signs.
In plain \TeX\  you would use |\eqalign| to display these kinds of
equations, or |\eqalignno| to display them with equation numbers.
With \TeXsis\  you should use \CS{EQNalign} in place of
\cs{eqalign} or \cs{eqalignno}
to get automatically assigned equation numbers in aligned
equations.   As in plain \TeX, the alignment of the
equations is controlled by |&| and |\cr|.  An equation number is
assigned to a particular line by putting |\EQN| followed by a
label on that line, before the |\cr|.  The label is everything
{from} the |\EQN| up to the |\cr|.  For example,
\index{equations!alignment}
\TeXexample
|smalltt$$
\EQNalign{
{dp \over dt} &= - {\partial H \over \partial q} 
\EQN Hamilton-1 \cr
{dq \over dt} &= {\partial H \over \partial p} 
\EQN Hamilton-2 \cr}
$$
|endTeXexample
produces the two aligned and numbered equations
$$
\EQNalign{
{dp \over dt} &= - {\partial H \over \partial q} \EQN Hamilton-1 \cr
{dq \over dt} &=   {\partial H \over \partial p} \EQN Hamilton-2 \cr}
$$            

   \cs{EQNalign} can be used both for typing multi-part equations or for
splitting an equation which is too long to fit on a single line.
However, when splitting a single long equation into several lines it may
actually be better to use |$$\eqalign{|\meta{formula}|}| followed by
|\EQN| \meta{label}|$$|.  For example, in
$$
\eqalign{
{\cal L}_{NC} &= {-g \over 2\cos\theta_W} \sum_i 
   \bar\psi_i [ (t_{3,i}-2Q_i\sin^2\theta_W) \gamma_\mu
   - t_{3,i}\gamma_\mu\gamma_5 ]\psi_i Z^\mu \cr
&\quad - e \sum_i Q_i \bar\psi_i \gamma_\mu \psi_i A^\mu \cr}
\EQN{NC}
$$
the equation number is centered between the two lines of the equation,
which looks better.
This equation was produced using \cs{eqalign} by typing:
\TeXexample
|smalltt$$
\eqalign{
{\cal L}_{NC} &= {-g \over 2\cos\theta_W} \sum_i 
   \bar\psi_i [ (t_{3,i}-2Q_i\sin^2\theta_W) \gamma_\mu
   - t_{3,i}\gamma_\mu\gamma_5 ]\psi_i Z^\mu \cr
&\quad - e \sum_i Q_i \bar\psi_i \gamma_\mu \psi_i A^\mu \cr}
\EQN{NC}
$$
|endTeXexample
             
   Closely related equations can be displayed together with the
same equation number by following the label with a semicolon and
a letter, as already described above.  For example, the set of
equations,
$$
\EQNalign{   
\nabla \cdot \vec D    &=  4 \pi \rho \EQN EM;a       \cr
\nabla \times \vec E   &= 
        - {1 \over c} {\partial \vec B \over \partial t}
        \EQN EM;b                                     \cr
\nabla \cdot \vec B    &=  0 \EQN EM;c                \cr
\nabla \times \vec H   &=  {4 \pi \over c} \vec J 
        + {1 \over c} {\partial \vec D \over \partial t} 
        \EQN EM;d                                     \cr}
$$                                                    
is produced by typing:
\TeXexample
|smalltt$$
\EQNalign{
\nabla \cdot \vec D    &=  4 \pi \rho \EQN EM;a       \cr
\nabla \times \vec E   &= 
        - {1 \over c} {\partial \vec B \over \partial t}
        \EQN EM;b                                     \cr
\nabla \cdot \vec B    &=  0 \EQN EM;c                \cr
\nabla \times \vec H   &=  {4 \pi \over c} \vec J 
        + {1 \over c} {\partial \vec D \over \partial t} 
        \EQN EM;d                                     \cr}
$$                                            
|endTeXexample                                
Note that the alignment of the equations is controlled by |&| and
|\cr|, not by the arrangement used when the equation was typed
into the manuscript file.  Still, it is recommended that you
arrange long sets of equations like these in some sort of clear
pattern when you type them.  This will both reduce errors when
the equation is typed and make it easier for you to read the file
when you are looking at it later.  Remember, \TeX\  ignores all
spaces and tabs when it reads material for equations or displayed
equations.
\index{equations!alignment}

   \CS{EQNdoublealign} is similar to \cs{EQNalign} but makes
equations with two alignment tabs. For example,
\TeXexample
|smalltt$$
\EQNdoublealign{
\sigma_i^2 &= 1 & \EQN Pauli;a \cr
\sigma_i\sigma_j + \sigma_j\sigma_i &= 0 \qquad & (i \ne j)
  \EQN Pauli;b \cr
\sigma_i\sigma_j &= i\sigma_k \qquad & (i,j,k\  {\rm cyclic})
   \EQN Pauli;c \cr}
$$
|endTeXexample
produces
$$
\EQNdoublealign{
\sigma_i^2 &= 1 & \EQN Pauli;a \cr                           
\sigma_i\sigma_j + \sigma_j\sigma_i &= 0 \qquad & (i \ne j)
  \EQN Pauli;b \cr
\sigma_i\sigma_j &= i\sigma_k \qquad & (i,j,k\  {\rm cyclic})
   \EQN Pauli;c \cr}
$$
with both the equal signs and the parentheses aligned. The second
|&| is required in the first line, because without it the |\EQN| would
have aligned the equation number with the parentheses enclosing $i\ne j$.

   Plain \TeX\  also lets you display formulae on several lines
without any alignment by using \cs{displaylines}.  With \TeXsis\  you
can use the similar control sequence \CS{EQNdisplaylines} to get an
automatically assigned equation number for any line in such a
display.  The pattern is the same as in |\displaylines|, but you
simply insert \cs{EQN}\meta{label} in front of the \cs{cr} on the
line you want numbered.  \CS{EQNdisplaylines} produces less space
between the equations than would result from typing them
separately, and generally looks better for closely related equations.

   All of the equation alignment macros are special cases of the plain
\TeX\  macro \cs{halign}. Therefore, if necessary, the vertical spacing can
be adjusted by inserting
\example
\cs{noalign}\cs{vskip}\meta{dimen}
\endexample
where \meta{dimen} can be either a positive or a negative dimension.
\bigskip

   In a long document there are several different ways to number
the equations.  You could just start at ``1'' and count up for
each new equation, but sometimes it is better to number the
equations consecutively within each chapter or section of a
document.  In \TeXsis\  the default form for an equation number is
$cc.ss.nn$ where $cc$ stands for the chapter number, $ss$ is the
section number, and $nn$ is the equation number within that
section.  Whenever you move to a new section or chapter (using
\cs{section} or \cs{chapter}, as described in
Section~\use{sect.sects}) the number $ss$ or $cc$ is incremented
by one and the number $nn$ is reset to one.  If you are not using
chapter divisions in your document then the chapter number $cc$
is not made a part of the equation number, and the number $nn$ is
reset only at the beginning of a section.  If you are not using
section divisions in your document then the section number $ss$
is not made a part of the equation number, and the number $nn$ is
reset to one only at the beginning of a chapter.  If you use
neither chapter nor section divisions in your document then
neither the chapter number $cc$ nor the section number $ss$ will
be made a part of the equation number, and the equations will
simply be numbered consecutively, 1, 2, 3\dots.
\index{equations!numbering}

   Although the system just described for forming equation
numbers gives a result that is usually what you will want for
your equation numbering, you can change the method by setting
either of two switches.  If you say |\showchaptIDfalse| then the
chapter number $cc$ will not be made a part of the equation
number even though you may be using chapter level divisions in
your document.  Similarly, saying |\showsectIDfalse| prevents the
section number $ss$ from being used in the equation number.  The
opposites of these two switches are \cs{showchaptIDtrue} and
\cs{showsectIDtrue}.  The equation number $nn$ is reset to one only
when a section or chapter number that is supposed to be visible
is incremented, as you might expect.
 
%>>> EOF TXSeqns.doc <<<