summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/deleq/delex.tex
blob: 4627f860d227f6f9ad11255ac1b3f00a9cb65e73 (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
%%
%% This is file `delex.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% deleq.dtx  (with options: `exempelkod')
%% 
%% 
%% Copyright (c) 1994-97 by Mats Dahlgren <matsd@homenet.se>.
%% All rights reserved.  See the file `deleq.ins' for information
%% on how you may (re-)distribute the `deleq' package files.
%% 
\documentclass[11pt]{article} %%% add `leqno' if you want left-aligned
\usepackage{deleq}            %%% equation numbers and `fleqn' to
\oddsidemargin=0.5cm          %%% flush the equations left.
\evensidemargin=0.5cm
\topmargin=-5mm
\textheight=23.5cm
\textwidth=15.5cm
\begin{document}
  \begin{center}
  \Large Welcome to the \textsf{deleq} package!
  \end{center}

  This is a short document to demonstrate the use of the
  \textsf{deleq} package and its commands.  It uses \deleqver .
  \textsf{deleq} was written by Mats Dahlgren
  (\texttt{matsd@physchem.kth.se}).  Suggestions for
  improvements and bug reports are most welcome, see the
  documentation.  \textsf{deleq} is fully compatible with the
  \texttt{leqno} option and most of the \texttt{fleqn} option.

  We start this demonstration by a simple and well-known
  equation to get the equation number counter going:
  \begin{equation}
    \sin^2\alpha + \cos^2\alpha = 1
  \end{equation}
  The first example will be to make use of the
  \texttt{deqn} environment to get a partially numbered
  equation:
  \begin{deqn}
    \sin (-\alpha) = - \sin \alpha
  \end{deqn}
  This equation has its cosine companion, here written in
  the \texttt{ddeqn} environment:
  \begin{ddeqn}
    \cos (-\alpha) = \cos \alpha
  \end{ddeqn}
  Not so exciting, so far. :--)

  In the next example we introduce the \texttt{deqarr}
  environment for writing equations:
  \begin{deqarr}
    \sin ( \alpha + \beta ) & =
      & \sin \alpha \cos \beta + \sin \beta \cos \alpha \\
    \sin ( \alpha - \beta ) & =
      & \sin \alpha \cos \beta - \sin \beta \cos \alpha
    \label{Demo1}
  \end{deqarr}
  where we also have put in the label \texttt{Demo1} in
  the second equation. Next, notice how the environment
  \texttt{ddeqar} uses the same main equation number as
  the previous equations:
  \begin{ddeqar}
    \cos ( \alpha + \beta ) & =
      & \cos \alpha \cos \beta - \sin \alpha \sin \beta
      \arrlabel{Demo2} \\
    \cos ( \alpha - \beta ) & =
      & \cos \alpha \cos \beta + \sin \alpha \sin \beta
  \end{ddeqar}
  In the first of these equations, an \verb+\arrlabel+ command
  with the label \texttt{Demo2} is included.
  Now, we will make another \texttt{eqnarray}-like
  structure, again in the \texttt{ddeqar} environment:
  \begin{ddeqar}
    \sin 2\alpha & =
      & 2 \sin \alpha \cos \alpha \heqno \label{Demo3} \\
    \cos 2\alpha & =
      & \cos ^2 \alpha - \sin ^2 \alpha \nydeqno \\
  \rem{or}
      & = & 2\cos ^2 \alpha - 1
  \end{ddeqar}
  This example shows the use of \verb$\heqno$ in the first
  equation, which produces an ordinary equation number.
  The first equation is also labelled, with the label
  \texttt{Demo3}.  The next equation's number was produced
  by the command \verb$\nydeqno$.  Also, notice the use of
  \verb+\rem{or}+, which results in the text ``or'' without
  changing the alignment.  To illustrate the use of
  \verb+\arrlabel{Demo2}+ above, we here make a reference to it:
  \ldots{} in equations \ref{Demo2} \ldots which was
  created by typing
  `\verb+\ldots{} in equations \ref{Demo2} \ldots+'.

  To step the equation number counter, we want the
  following equations typeset in ordinary
  \texttt{eqnarray} environment:
  \begin{eqnarray}
    \tan ^2 \alpha & =
      & \frac{\sin ^2 \alpha}{\cos ^2 \alpha} \label{Demo4} \\
    \tan \alpha & =
      & \frac{\sin \alpha}{\cos \alpha}
  \end{eqnarray}
  The upper equation was given the label \texttt{Demo4}.

  Now one of the ``recycling'' commands is to be
  demonstrated.  First of all, let's make an ordinary
  reference to equation~\ref{Demo3}, and then ``recycle'' it:
  $$ \sin 2\alpha = 2 \sin \alpha \cos \alpha \reqno{Demo3} $$
  This was obtained with \verb#$$ ... $$# with the command
  \verb#\reqno{Demo3}# at the end.  Also partially
  numbered equations can be recycled with the
  \verb#\reqno{FOO}# command, as with
  equation~\ref{Demo1}:
  $$ \sin ( \alpha - \beta ) = \sin \alpha \cos \beta -
    \sin \beta \cos \alpha \reqno{Demo1} $$
  (However, the use of \verb#\rndeqno{FOO}# and
  \verb#\rdeqno{FOO}# will produce strange results with
  two (different) partial equation numbers if \texttt{FOO}
  refers to a partially numbered equation.)

  The next equation was written with \verb#$$ ... $$# and
  a \verb#\deleqno# command at the end:
  $$ \tan 2\alpha = \frac{2\tan \alpha}{1 - \tan ^2 \alpha} \deleqno $$
  Notice how the main equation number counter is still the
  same, despite that we now are outside of the
  \texttt{ddeqar} environment. Also, notice how the use of
  \verb#\reqno# above did not affect the equation number
  counter. The following equation is also set within
  \verb#$$ ... $$#, but it uses the command
  \verb#\nydeleqno# to produce an equation number with a
  new main number:
  $$ \sin ^2 \alpha = 1 - \cos ^2 \alpha \nydeleqno $$

  Now we will elaborate a little on \verb#\rndeqno{FOO}#
  and \verb#\rdeqno{FOO}#. Let us use
  equation~\ref{Demo4}, and see what happens if we use the
  \verb#\rndeqno{FOO}# command:
  $$ \tan ^2 \alpha = \frac{\sin ^2 \alpha}
    {\cos ^2 \alpha} \rndeqno{Demo4} $$
  which we rewrite:
  $$ \tan ^2 \alpha = \frac{\sin ^2 \alpha}
    {1 - \sin ^2 \alpha} \rdeqno{Demo4}  \label{Demo5} $$
  with \verb#\rdeqno{Demo4}# at the end.  This is great
  fun, so why not one more:
  \begin{deqrarr}
  \tan ^2 \alpha = \frac{1 - \cos ^2 \alpha}
    {\cos ^2 \alpha} \ddeqreqno[-\jotbaseline]{Demo4}
  \nonumber
  \end{deqrarr}
  Also, the middle form of equation~\ref{Demo4} got a
  label, \texttt{Demo5}.  In the last example, the construct\\
  \verb+  \ddeqreqno[-\jotbaseline]{Demo4}   \nonumber+\\ in a
  \texttt{deqrarr} environment is used, to obtain
  \texttt{fleqn} compatibility.

  There is still one equation to write.  This time we
  again use the \texttt{deqarr} environment:
  \begin{deqarr}
  \cot \alpha & = & \frac{\cos \alpha}{\sin \alpha} \\
  \where
    & = & \frac{1}{\tan \alpha}
  \end{deqarr}
  This example also shows the use of the \verb+\where+
  command, which is a special case of the \verb+\rem+ command.
  Now, the interesting thing of referring to the recycled
  equations is ahead. If one writes \verb#\ref{Demo5}#,
  this is what \LaTeX\ will return:~\ref{Demo5}.  That is
  not too instructive, since the partial equation numbers
  are quite common in this document.  To make the complete
  reference, use \verb#\ref{Demo4}\ref{Demo5}#.  The
  reference~\ref{Demo4}\ref{Demo5} is much more
  comprehensible, right? (If you get bad line-breaks at
  such references, put them in an \verb#\mbox{...}#.)

  Now we will show the use of the commands to recycle equation
  numbers in \verb+eqnarray+-like structures.  These commands
  are \verb+\eqreqno{FOO}+, \verb+\deqreqno{FOO}+, and
  \verb+\ddeqreqno{FOO}+.  We start by repeating equation
  \ref{Demo1} in an \verb+deqrarr+ environment:
  \begin{deqrarr}
    \sin ( \alpha - \beta ) & =
      & \sin \alpha \cos \beta - \sin \beta \cos \alpha
      \eqreqno{Demo1}
    \sin 2\alpha & = & 2 \sin\alpha \cos\alpha
  \end{deqrarr}
  The second equation here shows how the alignment of the
  equations is preserved.  Next, we can use the equation
  \ref{Demo3} for some variations:
  \begin{deqrarr}
    \sin 2\alpha & = & 2 \sin\alpha \cos\alpha
      \deqreqno{Demo3}
    \sin 4\alpha & = & 2 \sin 2\alpha \cos 2\alpha \\
      & = & 2\left( 2\sin\alpha \cos\alpha
        \left( \cos^2 \alpha - \sin^2 \alpha\right)\right)
        \ddeqreqno{Demo3}
      & = & 4\left(\sin\alpha \cos\alpha
        \left( \cos^2 \alpha - \sin^2 \alpha\right)\right)
        \ddeqreqno[-\jotbaseline]{Demo3}
  \end{deqrarr}
  The features used here are \verb+\deqreqno{Demo3}+
  on the first line, \verb+\ddeqreqno{Demo3}+ on the
  second line, and \verb+\deqreqno[-\jotbaseline]{Demo3}+
  on the third.  Note how the inclusion of
  \verb+[-\jotbaseline]+ on the third line prevents
  \LaTeX{} from inserting an extra blank line.  The
  second line ends with `\verb+\\+', and has thus no
  equation number at all.

  The last part shows how you may use \verb+\eqreqno+ and its
  relatives in \verb+deqarr+ environment:
  \begin{deqarr}
    \sin\alpha & = & \sin\alpha \cos 0 + \sin 0 \cos\alpha \\
    \sin 2\alpha & = & 2 \sin\alpha \cos\alpha \eqreqno{Demo3}
    \sin 3\alpha & = & \sin 2\alpha \cos\alpha +
      \sin\alpha \cos 2\alpha \\
    \sin 4\alpha & = & 2 \sin 2\alpha \cos 2\alpha \\
    \sin 5\alpha & = & \sin 3\alpha \cos 2\alpha +
      \sin 2\alpha \cos 3\alpha \ddeqreqno{Demo3}
    \sin 6\alpha & = & 2 \sin 3\alpha \cos 3\alpha
  \end{deqarr}
  The interesting part here is an `\verb+\eqreqno{Demo3}+' at
  the end of the second line and a `\verb+\ddeqreqno{Demo3}+' at
  the end of the fifth line.  Notice how the partial
  equation number counter in unaffected by the enetering of
  the \verb+deqarr+ environment.

  Finally, the $\mathcal{END}$!  If you want your
  equation numbers left-aligned, just specify the \texttt{leqno}
  option for the \texttt{documentclass} you are using.  It
  should work!  If you have any suggestions, corrections
  or contributions, please contact me. Enjoy \LaTeX !

  {\itshape mats d.}
\end{document}
\endinput
%%
%% End of file `delex.tex'.