| 1 |
%%% ==================================================================== |
| 2 |
%%% @LaTeX-file{ |
| 3 |
%%% filename = "subeqn.tex", |
| 4 |
%%% version = "1.2c", |
| 5 |
%%% date = "1999/11/29", |
| 6 |
%%% time = "14:49:29 EST", |
| 7 |
%%% checksum = "29866 202 668 6426", |
| 8 |
%%% author = "American Mathematical Society", |
| 9 |
%%% copyright = "Copyright 1999 American Mathematical Society, |
| 10 |
%%% all rights reserved. Copying of this file is |
| 11 |
%%% authorized only if either: |
| 12 |
%%% (1) you make absolutely no changes to your copy, |
| 13 |
%%% including name; OR |
| 14 |
%%% (2) if you do make changes, you first rename it |
| 15 |
%%% to some other name.", |
| 16 |
%%% address = "American Mathematical Society, |
| 17 |
%%% Technical Support, |
| 18 |
%%% Electronic Products and Services, |
| 19 |
%%% P. O. Box 6248, |
| 20 |
%%% Providence, RI 02940, |
| 21 |
%%% USA", |
| 22 |
%%% telephone = "401-455-4080 or (in the USA and Canada) |
| 23 |
%%% 800-321-4AMS (321-4267)", |
| 24 |
%%% FAX = "401-331-3842", |
| 25 |
%%% email = "[email protected] (Internet)", |
| 26 |
%%% supported = "yes", |
| 27 |
%%% keywords = "latex, amslatex, ams-latex, amstex", |
| 28 |
%%% abstract = "This is part of the AMS-\LaTeX{} distribution. |
| 29 |
%%% It is a sample document illustrating the use of |
| 30 |
%%% the subequations environment and the effect of |
| 31 |
%%% the fleqn option.", |
| 32 |
%%% docstring = "The checksum field above contains a CRC-16 |
| 33 |
%%% checksum as the first value, followed by the |
| 34 |
%%% equivalent of the standard UNIX wc (word |
| 35 |
%%% count) utility output of lines, words, and |
| 36 |
%%% characters. This is produced by Robert |
| 37 |
%%% Solovay's checksum utility.", |
| 38 |
%%% } |
| 39 |
%%% ==================================================================== |
| 40 |
\documentclass[fleqn]{article} |
| 41 |
|
| 42 |
\title{Test of subequations environment} |
| 43 |
\author{mjd} |
| 44 |
|
| 45 |
\usepackage{amsmath} |
| 46 |
\numberwithin{equation}{section} |
| 47 |
|
| 48 |
\newcommand{\env}[1]{{\normalfont\texttt{#1}}} |
| 49 |
|
| 50 |
\AtEndDocument{\multipasswarning} |
| 51 |
\newcommand{\multipasswarning}{% |
| 52 |
\clearpage |
| 53 |
\typeout{% |
| 54 |
**********************************************************************} |
| 55 |
\typeout{% |
| 56 |
Note: This document needs to run through LaTeX three times, instead of} |
| 57 |
\typeout{% |
| 58 |
the usual two, to resolve indirect cross-references.} |
| 59 |
\typeout{% |
| 60 |
**********************************************************************} |
| 61 |
} |
| 62 |
|
| 63 |
\makeatletter |
| 64 |
% Omit the warning message if three passes have been completed (on |
| 65 |
% first pass \ref{check} is undefined and it is set to 0; on second |
| 66 |
% pass \ref{check} is 0 and set to 1; on third pass it is 1). |
| 67 |
\def\checkref{\begingroup |
| 68 |
\@ifundefined{r@check}{\let\r@check\relax\def\@currentlabel{0}}{\def\@currentlabel{1}}% |
| 69 |
\ifnum1=0\expandafter\@firstoftwo\r@check\relax |
| 70 |
\global\let\multipasswarning\relax |
| 71 |
\fi |
| 72 |
\label{check}% |
| 73 |
\endgroup} |
| 74 |
\makeatother |
| 75 |
|
| 76 |
\begin{document} |
| 77 |
\section{Prime equation numbers} |
| 78 |
|
| 79 |
First an equation. |
| 80 |
\begin{equation}\label{e:previous} |
| 81 |
A=B |
| 82 |
\end{equation} |
| 83 |
That was equation \eqref{e:previous}. |
| 84 |
|
| 85 |
Then the same, with a prime on the number.\checkref |
| 86 |
\begin{equation} |
| 87 |
\tag{\ref{e:previous}$'$}\label{e:prevprime} |
| 88 |
C=D |
| 89 |
\end{equation} |
| 90 |
And that was equation \eqref{e:prevprime}. |
| 91 |
|
| 92 |
Notice, by the way, that when a \verb"\ref" occurs inside a \verb"\tag", |
| 93 |
and that \verb"\tag" is then \verb"\label"'d, a \verb"\ref" for the |
| 94 |
second \verb"\label" requires \emph{three} runs of \LaTeX{} in order to |
| 95 |
get the proper value. (If you run through the logic of \LaTeX{}'s |
| 96 |
cross-referencing mechanisms as they apply in this case, you will see |
| 97 |
that this is necessary.) |
| 98 |
|
| 99 |
\section{Subnumbered equations} |
| 100 |
|
| 101 |
Here is a,b,c sub-numbering. |
| 102 |
\begin{subequations} |
| 103 |
\begin{eqnarray} |
| 104 |
A&=&B\\ |
| 105 |
D&=&C \label{e:middle}\\ |
| 106 |
E&=&F |
| 107 |
\end{eqnarray} |
| 108 |
\end{subequations} |
| 109 |
That was produced with the \env{eqnarray} environment; the middle line |
| 110 |
was labeled as \eqref{e:middle}. |
| 111 |
|
| 112 |
An equation following the end of the \verb"subequations" environment |
| 113 |
should revert to normal numbering: |
| 114 |
\begin{equation}\label{e:check} |
| 115 |
H<K |
| 116 |
\end{equation} |
| 117 |
A check on the labeling: that was equation~\eqref{e:check}. |
| 118 |
|
| 119 |
The sub-numbered equations can be spread out through the text, like |
| 120 |
this: |
| 121 |
\begin{subequations} |
| 122 |
\begin{equation} |
| 123 |
A=B |
| 124 |
\end{equation} |
| 125 |
The \verb"subequations" environment can span arbitrary text between |
| 126 |
subsidiary equations. The only restriction is that if there are any |
| 127 |
numbered equations inside the \verb"subequations" environment that break |
| 128 |
out of the subequation numbering sequence, they would have to be handled |
| 129 |
specially. |
| 130 |
\begin{equation} |
| 131 |
D=C \label{e:newmiddle} |
| 132 |
\end{equation} |
| 133 |
More arbitrary text. |
| 134 |
\begin{equation} |
| 135 |
E=F |
| 136 |
\end{equation} |
| 137 |
\end{subequations} |
| 138 |
Label check: the middle one was \eqref{e:newmiddle} |
| 139 |
|
| 140 |
A final equation for a numbering check. |
| 141 |
\begin{equation}\label{e:final} |
| 142 |
G=H |
| 143 |
\end{equation} |
| 144 |
That equation was labeled as \eqref{e:final}. |
| 145 |
|
| 146 |
\section{Tests of \env{align}, \env{gather}, and other |
| 147 |
AMS-\protect\LaTeX{} environments} |
| 148 |
|
| 149 |
The \env{align} environment: |
| 150 |
\begin{subequations} |
| 151 |
\begin{align} |
| 152 |
\label{align:a}A+B&=B+A\\ |
| 153 |
\label{align:b}C&=D+E\\ |
| 154 |
\label{align:c}E&=F |
| 155 |
\end{align} |
| 156 |
\end{subequations} |
| 157 |
Label check: that was \eqref{align:a}, \eqref{align:b}, and |
| 158 |
\eqref{align:c}. |
| 159 |
|
| 160 |
The \env{align} environment again: |
| 161 |
\begin{subequations} |
| 162 |
\begin{align} |
| 163 |
\label{xalign:a}A+B&=B& B&=B+A\\ |
| 164 |
\label{xalign:b}C&=D+E& C\oplus D&=E\\ |
| 165 |
\label{xalign:c}E&=F& E'&=F' |
| 166 |
\end{align} |
| 167 |
\end{subequations} |
| 168 |
Label check: that was \eqref{xalign:a}, \eqref{xalign:b}, and |
| 169 |
\eqref{xalign:c}. |
| 170 |
|
| 171 |
The \env{gather} environment. For the third line we refer to one of the |
| 172 |
numbers in the first \env{align} structure. |
| 173 |
\begin{subequations} |
| 174 |
\begin{gather} |
| 175 |
\label{gather:a}A+B=B\\ |
| 176 |
\label{gather:b}C=D+E\\ |
| 177 |
\tag{\ref{align:c}$'$}\label{gather:c}E=F |
| 178 |
\end{gather} |
| 179 |
\end{subequations} |
| 180 |
Label check: that was \eqref{gather:a}, |
| 181 |
\eqref{gather:b}, and |
| 182 |
\eqref{gather:c}. |
| 183 |
|
| 184 |
The next \env{subequations} environment encompasses two separate |
| 185 |
equations. A \env{split} environment: |
| 186 |
\begin{subequations} |
| 187 |
\begin{equation} |
| 188 |
\label{split:x} |
| 189 |
\begin{split} |
| 190 |
A&=B+C+F\\ |
| 191 |
&=G |
| 192 |
\end{split} |
| 193 |
\end{equation} |
| 194 |
and a \env{multline} environment: |
| 195 |
\begin{multline}\label{multline:x} |
| 196 |
A[B]C[D]E[F]G[[H[I]J[K]L[M]N]]=\\ |
| 197 |
H[I]J[K]L[M]N[O]P[Q]R[S]T[U]V[W]X[Y]Z |
| 198 |
\end{multline} |
| 199 |
\end{subequations} |
| 200 |
Label check: That was \eqref{split:x} and \eqref{multline:x}. |
| 201 |
|
| 202 |
\end{document} |