% % \iffalse % % The first part is a comment to the reader(s) of `deleq.dtx'. % % deleq.dtx Version 4.41b, June 5, 1998 % (c) 1994-98 by Mats Dahlgren (matsd@sssk.se) % % Please see the information in file `deleq.ins' on how you % may use and (re-)distribute this file. Run LaTeX on the file % `deleq.ins' to get a .sty-file, instructions, and an example. % % This file may NOT be distributed if not accompanied by 'deleq.ins'. % %<*driver> \documentclass[a4paper]{ltxdoc} \textwidth=150mm \textheight=210mm \topmargin=0mm \oddsidemargin=5mm \evensidemargin=5mm %\begin{document} \DocInput{deleq.dtx} % \PrintChanges \end{document} % % \fi % % \CheckSum{645} % % \def\filename{deleq.dtx} % \def\fileversion{4.41a} % \def\filedate{1997/07/07}\def\docdate{1997/06/05} % \MakeShortVerb{\|} % \date{\docdate} % \title{\textsf{deleq} -- a \LaTeX{} Macro for Partial % Numbering of Equations\thanks{This document describes % \textsf{deleq} version \fileversion , last revised \docdate}} % \author{Mats Dahlgren\footnote{Email:\ \texttt{matsd@sssk.se}\ \ \ % Web:\ \texttt{http://www.homenet.se/matsd/}}} % \begin{document} % \maketitle % \begin{abstract} % To enable a more flexible equation numbering, especially % ``partial'' equation numbers (`3a', `3b' \textit{etc.}), % the \textsf{deleq} package has been developed. It can produce % partial equation numbers intermixed with ordinary % equation numbers also in an |eqnarray|-like environment, % the intermixing can occur within one environment. % References to a partially numbered equation can be both the % complete equation number (`3b') or only the main equation % number (`3'). % Furthermore, equation numbers can be recycled without % disturbing the ordinary equation numbers. The % package also provides commands for putting commentatory % text in an |eqnarray| environment. % Both standard \LaTeX{} class options % |leqno| and |fleqn|\footnote{Not all commands of % \textsf{deleq} work with the \texttt{fleqn} option.} % work with \textsf{deleq}.\\ % \small This file and the package:\ % Copyright \copyright\ 1994-1998 by Mats Dahlgren. % All rights reserved. % \end{abstract} % % \section{Introduction} % \textsf{deleq} is a \LaTeX{} package which makes partial % numbering of equations possible. It is meant to be used % when numbering such as 3a, 3b, \textit{etc.} is desired. % The default is to give an equation number like `3a' % without period and with the `a' typeset in roman font. % It can be used in |article| as well as |book| and % |report| document classes. The examples given below are % valid for the |article| class. \textsf{deleq} is fully % compatible with the |leqno| documentclass option and % almost fully with the |fleqn| class option. % Equations can be numbered either 3, 3a, 3b, $\ldots$, or % 2, 3a, 3b, $\ldots$. Also, equation numbers within % |eqnarray|-like environments can be numbered 3, 3a, 3b, % $\ldots$ or starting at 3a, which can follow both after % equation 2b or 3. An |eqnarray|-like environment can have % its first equation numbered 3b if the nearest previous % equation is 3a. Within one |eqnarray|-like environment, % equations can be numbered 3a, 3b, 4, 4a, 4b, 5a, 5b, % \textit{etc.}, and also not numbered lines are possible % (`|\nonumber|' works with some limitations). % Furthermore, equation numbers can % be ``recycled''. If equation 3 is repeated after % equation 8, it can still have the numbering set to 3, % and be followed by (a new) equation 9. ``Recycled'' % equation numbers can receive partial numbers (3a, 3b, % $\ldots$); partially numbered equations can also be % ``recycled'' (but at this stage, the latter can not % receive new partial numbers neatly, it will come out % like `3ba' if eqution 3b is the ``recycled'' equation). % Two commands are supplied which enable the user to write % commentary texts in |eqnarray|-like environments without % interfering with the alignment. % % This userguide is also available in \texttt{.pdf}-format % on the internet. It is found from my \LaTeX\ web page: % \texttt{http://www.homenet.se/matsd/latex/} % % \subsection{History} % |deleq.sty| was originally written for \LaTeX{} 2.09, % and contained several commands which became obsolete % with the introduction of \LaTeXe. These commands have % been removed. The first release for \LaTeXe{} was v.4.0, % of Oct.~14, 1994. The December 1994 release % (v.4.1, Dec.~27, 1994) was the first which was compatible with the % |docstrip| utility of Johannes Braams, Denys Duchier and % Frank Mittelbach. In release v.4.2 new % abilities to reference entire |deqarr| and |ddeqar| % environments and enhanced abilities for recycled % equation numbers were introduced. % Also in \textsf{deleq} v.4.2 this % documentation was revised and some internal commands % compacted. % A previous release, v.4.3, was made nessecary % because the changed handeling of arguments in connection % with the options in \LaTeXe{} of 1995/06/01. % In release v.4.4, compatibility with the \LaTeX{} % class option |fleqn| was % introduced.\footnote{\texttt{fleqn} incompatibility was % pointed out by Peter Kruijt (\texttt{peterk@wfw.wtb.tue.nl})} % In v.4.41 only some changes to the documentation have been introduced. % % \textsf{deleq} version 4.41 has been tested with \LaTeXe{} % of 1997/06/01 running \TeX{} 3.14159 in MiK\TeX{} 1.07 % under Windows~95. Please send bug reports (see below), % corrections, additions, suggestions, \textit{etc.}\ to % me at \texttt{matsd@sssk.se}. % Version 3.02 is the last % (non-supported) version for \LaTeX{} 2.09. (Command names % are a mixture of \LaTeX , Swedish and a bit of the % author's fantasy$\ldots$) % % \subsection{Known Problems} % \begin{itemize} % \item \DescribeMacro{\eqreqno} \DescribeMacro{\deqreqno} % \DescribeMacro{\ddeqreqno} \DescribeEnv{deqarr} % \DescribeEnv{ddeqar} \DescribeMacro{\jotbaseline} % When using |\eqreqno|, |\deqreqno|, and |\ddeqreqno| % on the last line in a |deqarr|, |ddeqar|, |eqnarray|, or % |eqnarray*|, there will be an extra blank line with an % equation number (not in the |*| form) at the end of the % environment. To avoid this problem, use\\ % | \eqreqno[-\jotbaseline]{FOO} \nonumber|\\ % instead of % |\eqreqno{FOO}| (the analogues for |\deqreqno| and % |\ddeqreqno| are obvious). % \end{itemize} % % \section{Userguide} % \subsection{Requirements} % The file |deleq.sty| must be available in the user's % |TEXINPUTS| directories. % It requires \LaTeXe{} of 1996/12/01 (or newer). % % \subsection{Usage} % The package is included by stating\\ % | \usepackage{deleq}| \\ % In the document preamble. % The documentclass option |leqno| is fully supported, % and the option |fleqn| is recognized by the environments % defined in \textsf{deleq}. % Other class or package options do not have any effect on % \textsf{deleq}. % % \subsection{Environments} % The package defines the following five environments: % \begin{description} % \item{\texttt{deqn}} \DescribeEnv{deqn} % is an equation environment for automatic % numbering of the first equation of type `3a'; % \item{\texttt{ddeqn}} \DescribeEnv{ddeqn} % is an equation used for automatic numbering % of the equations following the one in |deqn|, see also details % below; % \item{\texttt{deqarr}} \DescribeEnv{deqarr} % is an environment for automatic partial equation % numbering in |eqnarray|-like environment with % |deqn| functionality for the first equation; % \item{\texttt{ddeqar}} \DescribeEnv{ddeqar} % similar to |deqarr| environment, but % with |ddeqn| behaviour for the first equation, see details below; % \item{\texttt{deqrarr}} \DescribeEnv{deqrarr} % this is an `|eqnarray|'-like environment % specially designed for recycled equation numbers. % \end{description} % % \subsection{Commands} % The package defines the following fourteen user commands:\\ % \hspace*{5mm}|\nydeqno|\\ % \hspace*{5mm}|\heqno|\\ % \hspace*{5mm}|\reqno{FOO}|\\ % \hspace*{5mm}|\rndeqno{FOO}|\\ % \hspace*{5mm}|\rdeqno{FOO}|\\ % \hspace*{5mm}|\eqreqno[|\textit{len}|]{FOO}|\\ % \hspace*{5mm}|\deqreqno[|\textit{len}|]{FOO}|\\ % \hspace*{5mm}|\ddeqreqno[|\textit{len}|]{FOO}|\\ % \hspace*{5mm}|\arrlabel{FOO}|\\ % \hspace*{5mm}|\where|\\ % \hspace*{5mm}|\rem{|\textit{text}|}|\\ % \hspace*{5mm}|\nydeleqno|\\ % \hspace*{5mm}|\deleqno|\\ % \hspace*{5mm}|\jotbaseline|\\ % % \subsection{Notice} % \begin{enumerate} % \item % \DescribeMacro{\nydeqno} \DescribeMacro{\heqno} % \DescribeMacro{\arrlabel} \DescribeEnv{deqarr} % \DescribeEnv{ddeqarr} % The use of |\arrlabel| may give unexpected results if % any of the commands |\nydeqno| or |\heqno| is used in the % same |deqarr| or |ddeqar| environment. % \item If you use |\nydeqno|, % |\heqno|, |\reqno|, |\rndeqno|, |\rdeqno|, % |\deqreqno|, |\ddeqreqno|, |\nydeleqno|, or |\deleqno| in % combination with |\label{FOO}|, |\label{FOO}| should % appear after the \textsf{deleq}-command; % \item If you change the appearance of equation numbers % (\textit{e.g.}\ use % `[2]' instead of `(2)'), \textsf{deleq}'s commands may not typeset % equations with partial numbers like your ordinary % equations. % \item The class option |fleqn| is not recognized by the % commands |\reqno|, |\rndeqno|, |\rdeqno|, |\nydeleqno|, and % |\deleqno|. % \end{enumerate} % % \section{Syntax} % Here follows a more detailed description of the % different environments and commands. % \begin{description} % \item{|\begin{deqn} ... \end{deqn}|} \DescribeEnv{deqn} \\ % Typesets an equation just like % |\begin{equation} ... \end{equation}| does, but gives it % a number such as `3a' instead of `3' (always `a'). It % steps the main equation counter. % % \item{|\begin{ddeqn} ... \end{ddeqn}|} \DescribeEnv{ddeqn} \\ % Typesets an equation just like % |\begin{equation} ... \end{equation}| does, but gives it % a number such as `3b', `3c', $\ldots$ instead of `3', % `4', $\ldots$ when following after another partially % numbered equation. When following after an ordinarily % numbered equation (`3') it gives a partial equation % number with the last used ordinary equation number, % \textit{e.g.}\ `3a'. Can be made to produce the result % of |deqn| environment by the use of |\nydeqno| (see % below). |ddeqn| does not step the main equation counter. % % \item{|\begin{deqarr} ... \end{deqarr}|} \DescribeEnv{deqarr} \\ % Typesets an equation array just like % |\begin{eqnarray} ... \end{eqnarray}| does, but gives % the first numbered equation a number like `3a' instead % of `3' (always `a'), and the following `3b', `3c' % \textit{etc.} It steps the main equation counter. % The |\nonumber| command works just like % in the |eqnarray| environment on the partial equation % counter. Thus, if you use |\nonumber| on all lines in an % |deqarr| environment (or on all lines before or between % |\heqno| or |\nydeleqno|) the equation numbering in your % document will be incorrect. There is no warning issued by % \LaTeX{} if this happends. If you want blank lines and % then a |\heqno|'ed equation followed by partially numbered % equations, use the |ddeqar| environment instead. The same % is true for |\nydeqno|'ed equations. % % \item{|\begin{ddeqar} ... \end{ddeqar}|} \DescribeEnv{ddeqar} \\ % Typesets an equation array just like % |\begin{eqnarray} ... \end{eqnarray}| does, but gives % the equation numbers such as `3a' if following after an % equation numbered `3' (ordinary equation number) and % numbers such as `3c' if following after a partially % numbered equation `3b'. Can be made to produce the % result of |deqarr| environment by the use of |\nydeqno|. % |ddeqar| does not step the main equation counter. % The |\nonumber| command works like in the % |deqarr| environment. % % \item{|\begin{deqrarr} ... \end{deqrarr}|} \DescribeEnv{deqrarr} \\ % This environment is meant to host recycled equations and has % |eqnarray| structure. By default, it issues no equation % number at all on a line which ends with |\\|. The use of % |\label{FOO}| within |deqrarr| returns the present partial % equation number of recycled equations (just like with % |\rndeqno| and |\rdeqno|). Note that neither |\heqno| % nor |\nydeleqno| gives any equation numbers at all in the % |deqrarr| environment. % % \item{|\nydeqno|} \DescribeMacro{\nydeqno} \\ % Used within |deqarr| and |ddeqar| environments to % step the main equation number by one and reset the % partial equation number to `a'; thus, |\nydeqno| gives % equation number `4a' when following after equation `3c'. % % \item{|\heqno|} \DescribeMacro{\heqno} \\ % Used within |deqarr| and |ddeqar| % environments to step the main equation number by one and % to produce an ordinary equation number; thus, gives % equation number `4' when following equation `3c'. % Equations following the |\heqno|-ed will be partially % numbered with the |\heqno|-ed equation's number as the % main number, \textit{e.g.}\ `4a' (unless it has a |\nydeqno| % command, which in this case would produce the equation % number `5a'). % % \item{|\reqno{FOO}|} \DescribeMacro{\reqno} \\ % Is used when repeating an equation with its original % number, ``recycling'' the eqaution number. % |\reqno| takes the argument |FOO|, which has to be defined % by a |\label{FOO}| in the original equation. It can % only be used within |$$ ... $$|. It does not affect the % equation number counter, nor the ordinary partial equation number % counter. However, it resets the partial equation number % counter for the |\rndeqno|, |\rdeqno|, |\deqreqno|, and % |\ddeqreqno| commands. If used with a |\label{FOOO}| % command, the |.aux|-file will only contain the page number % of label |FOOO|. This command is not compatible with the % class option |fleqn|. Instead of |$$ ... \reqno{FOO} $$|, % use a one-line |deqrarr| environment with the commands % |\eqreqno[-\jotbaseline]{FOO} \nonumber| at the end. % % \item{|\rndeqno{FOO}|} \DescribeMacro{\rndeqno} \\ % Adds a partial equation number to an old equation number, % specified by the |FOO| label. If |FOO| refers to equation % `4', |\rdeqno{FOO}| will result in equation number `4a' % (always `a'). It can only be used within % |$$ ... $$|. It does not affect the equation number counter, % nor the ordinary partial equation number counter. However, it % resets the partial equation number counter for the % |\rndeqno|, |\rdeqno|, |\deqreqno|, and |\ddeqreqno| commands. % The argument of |\rndeqno| follows the same rules as that of % |\reqno|. When used with the |\label{FOOO}| command, a % reference to |FOOO| will only return the partial equation % number (and the page number). To make a complete reference % to an equation which has a |\rndeqno| command, say % |\ref{FOO}\ref{FOOO}|. This command is not compatible with the % class option |fleqn|. Instead of |$$ ... \rndeqno{FOO} $$|, % use a one-line |deqrarr| environment with the commands % |\deqreqno[-\jotbaseline]{FOO} \nonumber| at the end. % % \item{|\rdeqno{FOO}|} \DescribeMacro{\rdeqno} \\ % Same as |\rndeqno{FOO}| but without resetting any % equation number counter and giving consecutive partial % equation numbers (`4b', `4c', \textit{etc.}). % \textbf{Note: } There is nothing preventing the % repeated use of |\rndeqno{FOO}| and |\rdeqno{FOO}| for % the same label |FOO|. This will result in numbering such % as `3a' (if |FOO| refers to equation `3') occuring several % times. This command is not compatible with the % class option |fleqn|. Instead of |$$ ... \rdeqno{FOO} $$|, % use a one-line |deqrarr| environment with the commands % |\ddeqreqno[-\jotbaseline]{FOO} \nonumber| at the end. % % \item{|\eqreqno[|\textit{len}|]{FOO}|} % \DescribeMacro{\eqreqno} \\ % This command is the array-like version of |\reqno{FOO}| and % is used in much the same way. The optional argument \textit{len} % is a length which is added between consecutive rows in the array-like % structure. When using |\eqreqno| no `|\\|' should be issued % at the end of the line, it is embedded in the command. This % is giving a strange appearance if |\eqreqno| is used on the % last line of the array-like sturcture, namely an extra blank % line (with equation number). To avoid this problem, specify % a negative length for \textit{len}, preferably `|-\jotbaseline|' % (se below), and issue a `|\nonumber|' afterwards. % % \item{|\deqreqno[|\textit{len}|]{FOO}|} % \DescribeMacro{\deqreqno} \\ % This is the `|\rndeqno|' version of `|\eqreqno|' and is used % as the former with the latter's abilities at the end of a % line. % % \item{|\ddeqreqno[|\textit{len}|]{FOO}|} % \DescribeMacro{\ddeqreqno} \\ % This is the `|\rdeqno|' version of `|\eqreqno|' and is used % as the former with the latter's abilities at the end of a % line. % % \item{|\arrlabel{FOO}|} \DescribeMacro{\arrlabel} \\ % This command is a version of \LaTeX 's ordinary % |\label{FOO}| command meant to be used in |deqarr| and % |ddeqar| environments. In these environments, a % |\label{FOO}| command gives a reference to the specific % equation, \textit{e.g.}\ 3b, whereas |\arrlabel{FOO}| in the % same position gives a reference containing only the main % equation number, 3 in this example. For restrictions, see % the section ``Notice'' above. The four commands |\eqreqno|, % |\deqreqno|, |\ddeqreqno|, and |\arrlabel| were created after % inspiration from Larry Jones (\texttt{schnuff@mit.edu}). % % \item{|\where|} \DescribeMacro{\where} \\ % The command |\where| typsets the text ``where'' (in % the default LR-font) flush left on a seperate row in % |eqnarray|, |deqarr|, |ddeqar|, and |deqrarr| environments, % and preserves the environment's alignment for rows to come. % % \item{|\rem{|\textit{text}|}|} \DescribeMacro{\rem{text}} \\ % The command |\rem{|\textit{text}|}| typsets the text % ``\textit{text}'' (in the default LR-font) flush left on % a seperate row in |eqnarray|, |deqarr|, |ddeqar|, and |deqrarr| % environments, and preserves the environment's alignment % for rows to come. |\where| is equivalent to % |\rem{where}|. % % \item{|\nydeleqno|} \DescribeMacro{\nydeleqno} \\ % Gives a new partial equation number when used within |$$ ... $$|. % Thus, writing |$$ ...| |\nydeleqno $$| is equivalent to % writing |\begin{deqn} ... \end{deqn}|. % This command is not compatible with the % class option |fleqn|, use |\begin{deqn} ... \end{deqn}| % instead. % % \item{|\deleqno|} \DescribeMacro{\deleqno} \\ % Gives a partial equation number when used within |$$ ... $$|. % Thus, writing |$$ ...| |\deleqno| |$$| is equivalent to % writing |\begin{ddeqn} ... \end{ddeqn}|. % This command is not compatible with the % class option |fleqn|, use |\begin{ddeqn} ... \end{ddeqn}| % instead. % % \item{|\jotbaseline|} \DescribeMacro{\jotbaseline} \\ % This is a rubber length which is set to be the sum of % |\baselinsekip| and |\jot| each time a |deqarr|, |ddeqar|, % or a |deqrarr| environment is enterd. It is meant to be % used with the |\eqreqno| command and its relatives to % eliminate the problems when these commands are used on the % last line of the environment. (The length |\baselineskip| + % |\jot| is the length \LaTeX{} skips between two % empty lines in an `|eqnarray|' environment and its % derivates defined in \textsf{deleq}.) % % \end{description} % % \section{Example} % After running \LaTeX{} on |deleq.ins|, there is an % example avaliable in the file |delex.tex|, % which makes use of all the environments and commands % defined in the \textsf{deleq} package. Typset it and see with % your own eyes what the results are! % % % \section{Sending a Bug Report} % \textsf{deleq} is most likely to contain bugs. % Reports of bugs in the package are most welcome. % Before filing a bug report, % please take the following actions: % \begin{enumerate} % \item Ensure your problem is not due to your inputfile; % \item Ensure your problem is not due to % your own package(s) or class(es); % \item Ensure your problem is not covered in the section % ''Known Problems'' above; % \item Try to locate the problem by writing a minimal % \LaTeX{} input file which reproduces the problem. % Include the command\\ % | \setcounter{errorcontextlines}{999}|\\ % in your input; % \item Run your file through \LaTeX{}; % \item Send a description of your problem, the input file % and the log file via e-mail to:\\ % | matsd@sssk.se| % \end{enumerate} % {\itshape Enjoy your \LaTeX!\raisebox{-\baselineskip}{mats d.}} % \StopEventually{\par\vfill\hfill{\scriptsize Copyright % \copyright{} 1994-98 by Mats Dahlgren.}} % \newpage % % \section{The Code} % For the interested reader(s), here is a short description % of the code. \par % \iffalse %<*paketkod> % Part 1: Identification etc. % \fi % First, the package is to identify itself. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1996/12/01] \ProvidesPackage{deleq}[1997/07/07 v.4.41 Partial equation numbering] \def\deleqver{\textsf{deleq} version 4.41 (July~7, 1997)} % \end{macrocode} % \iffalse % Part 2: Counters and internal commands, etc. % \fi % \par Then, we need to define the counters used for the partial % part of the equation number. The counter |Deleq| is used for % ``recycled'' equation numbers, hence no dependence on any other % counter. % \begin{macrocode} \newcounter{deleq}[equation] \newcounter{Deleq} \newlength{\jotbaseline} \renewcommand{\thedeleq}{\ensuremath{\theequation\mathrm{\alph{deleq}}}} \renewcommand{\theDeleq}{\ensuremath{\mathrm{\alph{Deleq}}}} \def\@deleqnnum{(\thedeleq)} \def\@deleqrnum#1{(\ref{#1}\theDeleq)} \def\@eqrnum#1{(\ref{#1})} % \end{macrocode} % The parts making up the |\\| command in the multiline environments % are similar to those used by the standard environments % (at least how they looked some time ago): % \begin{macrocode} \def\@deqncr{{\ifnum0=`}\fi\@ifstar{\global\@eqpen\@M \@ydeqncr}{\global\@eqpen\interdisplaylinepenalty \@ydeqncr}} \def\@ydeqncr{\@ifnextchar [{\@xdeqncr}{\@xdeqncr[\z@]}} \def\@xdeqncr[#1]{\ifnum0=`{\fi}\@@deqncr \noalign{\penalty\@eqpen\vskip\jot\vskip #1\relax}} \def\@@deqncr{\let\@tempa\relax \ifcase\@eqcnt \def\@tempa{& & &}\or \def\@tempa{& &}% \else \def\@tempa{&}\fi \@tempa \if@eqnsw\@deleqnnum\stepcounter{deleq}\fi \global\@eqnswtrue\global\@eqcnt\z@\cr} \newcommand{\@xeqrcr}[2]{\ifnum0=`{\fi}\@@eqrcr{#2} \noalign{\penalty\@eqpen\vskip\jot\vskip #1\relax}} \def\@@eqrcr#1{\let\@tempa\relax \ifcase\@eqcnt \def\@tempa{& & &}\or \def\@tempa{& &}% \else \def\@tempa{&}\fi \@tempa \if@eqnsw\@eqrnum{#1}\fi \global\@eqnswtrue\global\@eqcnt\z@\cr} \newcommand{\@xdeqrcr}[2]{\ifnum0=`{\fi}\@@deqrcr{#2} \noalign{\penalty\@eqpen\vskip\jot\vskip #1\relax}} \def\@@deqrcr#1{\let\@tempa\relax \ifcase\@eqcnt \def\@tempa{& & &}\or \def\@tempa{& &}% \else \def\@tempa{&}\fi \@tempa \if@eqnsw\@deleqrnum{#1}\fi \global\@eqnswtrue\global\@eqcnt\z@\cr} \def\@deqrarcr{{\ifnum0=`}\fi\@ifstar{\global\@eqpen\@M \@ydeqrarcr}{\global\@eqpen\interdisplaylinepenalty \@ydeqrarcr}} \def\@ydeqrarcr{\@ifnextchar [{\@xdeqrarcr}{\@xdeqrarcr[\z@]}} \def\@xdeqrarcr[#1]{\ifnum0=`{\fi}\@@deqrarcr \noalign{\penalty\@eqpen\vskip\jot\vskip #1\relax}} \def\@@deqrarcr{\let\@tempa\relax \ifcase\@eqcnt \def\@tempa{& & &}\or \def\@tempa{& &}% \else \def\@tempa{&}\fi \@tempa \global\@eqnswtrue\global\@eqcnt\z@\cr} % \end{macrocode} % \iffalse % Part 3: Commands: \nydeleqno, \deleqno, \reqno, \rndeqno, \rdeqno, % \eqreqno, \deqreqno, \ddeqreqno, \arrlabel, % \nydeqno, and \heqno % \fi % \par Here the definitions of the user commands are. % \begin{macrocode} \newcommand{\nydeleqno}{\stepcounter{equation}\stepcounter{deleq} \let\@currentlabel\thedeleq \eqno (\thedeleq)} \newcommand{\deleqno}{\refstepcounter{deleq} \let\@currentlabel\thedeleq \eqno (\thedeleq)} \newcommand{\reqno}[1]{\setcounter{Deleq}{-1}\refstepcounter{Deleq} \eqno (\ref{#1})} \newcommand{\rdeqno}[1]{\refstepcounter{Deleq} \eqno (\ref{#1}\theDeleq)} \newcommand{\rndeqno}[1]{\setcounter{Deleq}{0}\refstepcounter{Deleq} \eqno (\ref{#1}\theDeleq)} \newcommand{\eqreqno}[2][0pt]{{\ifnum0=`}\fi\@ifstar{\global\@eqpen\@M \@xeqrcr{#1}{#2}}{\global\@eqpen\interdisplaylinepenalty \@xeqrcr{#1}{#2}}} \newcommand{\deqreqno}[2][0pt]{\setcounter{Deleq}{0}\refstepcounter{Deleq} {\ifnum0=`}\fi\@ifstar{\global\@eqpen\@M \@xdeqrcr{#1}{#2}}{\global\@eqpen\interdisplaylinepenalty \@xdeqrcr{#1}{#2}}} \newcommand{\ddeqreqno}[2][0pt]{\refstepcounter{Deleq} {\ifnum0=`}\fi\@ifstar{\global\@eqpen\@M \@xdeqrcr{#1}{#2}}{\global\@eqpen\interdisplaylinepenalty \@xdeqrcr{#1}{#2}}} \newcommand{\arrlabel}[1]{\let\@currentlabel\theequation \label{#1}} \newcommand{\nydeqno}{\stepcounter{equation}\stepcounter{deleq}} \newcommand{\heqno}{\stepcounter{equation}} \def\where{\let\@tempa\relax \def\@tempa{& & &} \@tempa {\hbox to .01\p@{}\rlap{\hskip -\displaywidth where}}\cr} \def\rem#1{\let\@tempa\relax \def\@tempa{& & &} \@tempa {\hbox to .01\p@{}\rlap{\hskip -\displaywidth #1}}\cr} % \end{macrocode} % \iffalse % Part 4: Environments: 'deqarr', 'ddeqar', 'deqn', 'ddeqn', and 'deqrarr' % \fi % \par The five environments are slight modifications of the % corresponding \LaTeX{} standard environments. The main difference % lies in which counter(s) is stepped and which internals are used to % finish off the lines. Three of them have large parts in % common, parts which are put in one macro `|\@dlqnv|': % \begin{macrocode} \def\@dlqnv{\setlength{\jotbaseline}{\baselineskip}% \addtolength{\jotbaseline}{\jot} \global\@eqnswtrue\m@th \global\@eqcnt\z@\tabskip\@centering $$\halign to\displaywidth\bgroup\@eqnsel\hskip\@centering $\displaystyle\tabskip\z@{##}$&\global\@eqcnt\@ne \hskip 2\arraycolsep \hfil${##}$\hfil &\global\@eqcnt\tw@ \hskip 2\arraycolsep $\displaystyle\tabskip\z@{##}$\hfil \tabskip\@centering&\llap{##}\tabskip\z@\cr} \newenvironment{deqarr}{\stepcounter{equation}\stepcounter{deleq} \let\@currentlabel\thedeleq \let\\\@deqncr \@dlqnv} {\@@deqncr\egroup \global\advance\c@deleq\m@ne$$\global\@ignoretrue} \newenvironment{ddeqar}{\stepcounter{deleq} \let\@currentlabel\thedeleq \let\\\@deqncr \@dlqnv} {\enddeqarr} \newenvironment{deqn}{$$\refstepcounter{equation}\stepcounter{deleq} \let\@currentlabel\thedeleq} {\eqno \hbox{\@deleqnnum} $$\global\@ignoretrue} \newenvironment{ddeqn}{$$\refstepcounter{deleq} \let\@currentlabel\thedeleq} {\enddeqn} \newenvironment{deqrarr}{\let\@currentlabel\theDeleq \let\\\@deqrarcr \@dlqnv} {\@deqrarcr \egroup $$\global\@ignoretrue} % \end{macrocode} % \iffalse % Part 5: 'leqno' compatibility % \fi % \par If the user wants the equation numbers to the left, we have to % modify some of the commands and internals defined above. This is % done in a |\DeclareOption|-call, but first we set a % switch to test for the |leqno| option. Initially, it is set % to |F| and then changed to |T| if the |leqno| option is in effect. % \begin{macrocode} \newif\ifl@qn \l@qnfalse \DeclareOption{leqno}{% \global\l@qntrue% \renewcommand{\@deleqnnum}{\hbox to .01\p@{}\rlap{\reset@font\rmfamily \hskip -\displaywidth(\thedeleq)}} \renewcommand{\nydeleqno}{\stepcounter{equation}\stepcounter{deleq} \let\@currentlabel\thedeleq \leqno (\thedeleq)} \renewcommand{\deleqno}{\refstepcounter{deleq} \let\@currentlabel\thedeleq \leqno (\thedeleq)} \renewcommand{\reqno}[1]{\setcounter{Deleq}{-1}\refstepcounter{Deleq} \leqno (\ref{#1})} \renewcommand{\rdeqno}[1]{\refstepcounter{Deleq} \leqno (\ref{#1}\theDeleq)} \renewcommand{\rndeqno}[1]{\setcounter{Deleq}{0}\refstepcounter{Deleq} \leqno (\ref{#1}\theDeleq)} \renewcommand{\@eqrnum}[1]{\hbox to .01\p@{}\rlap{\reset@font\rmfamily \hskip -\displaywidth(\ref{#1})}} \renewcommand{\@deleqrnum}[1]{\hbox to .01\p@{}\rlap{\reset@font\rmfamily \hskip -\displaywidth(\ref{#1}\theDeleq)}} } % \end{macrocode} % \iffalse % Part 6: `fleqn' compatibility % \fi % \par The |fleqn| option is mainly a `\textsf{deleq}-ification' of % the \LaTeXe{} file |fleqn.clo| (1995/06/26 v1.3g). If both % |leqno| and |fleqn| options are in use, the length % |\mathindent| should be increased to allow space for the % letters of the partial equation numbers. For the % multiline environments, it is enough to make changes to the % internal |\@dlqnv|. % \begin{macrocode} \DeclareOption{fleqn}{% \ifl@qn \AtBeginDocument{\addtolength{\mathindent}{1em}} \fi \renewenvironment{deqn}% {\@beginparpenalty\predisplaypenalty \@endparpenalty\postdisplaypenalty \refstepcounter{equation}\stepcounter{deleq} \let\@currentlabel\thedeleq% \trivlist \item[]\leavevmode \hb@xt@\linewidth\bgroup $\m@th% $ \displaystyle \hskip\mathindent}% {$\hfil % $ \displaywidth\linewidth\hbox{\@deleqnnum}% \egroup \endtrivlist} \renewenvironment{ddeqn}% {\@beginparpenalty\predisplaypenalty \@endparpenalty\postdisplaypenalty \refstepcounter{deleq} \let\@currentlabel\thedeleq% \trivlist \item[]\leavevmode \hb@xt@\linewidth\bgroup $\m@th% $ \displaystyle \hskip\mathindent}% {\enddeqn} \renewcommand{\@dlqnv}{% \setlength{\jotbaseline}{\baselineskip} \addtolength{\jotbaseline}{\jot} \global\@eqcnt\z@ \tabskip\mathindent \setlength\abovedisplayskip{\topsep}% \ifvmode \addtolength\abovedisplayskip{\partopsep}% \fi \addtolength\abovedisplayskip{\parskip}% \setlength\belowdisplayskip{\abovedisplayskip}% \setlength\belowdisplayshortskip{\abovedisplayskip}% \setlength\abovedisplayshortskip{\abovedisplayskip}% $$\everycr{}\halign to\linewidth% $$ \bgroup \hskip\@centering $\displaystyle\tabskip\z@skip{##}$\@eqnsel&% \global\@eqcnt\@ne \hskip \tw@\arraycolsep \hfil${##}$\hfil&% \global\@eqcnt\tw@ \hskip \tw@\arraycolsep $\displaystyle{##}$\hfil \tabskip\@centering&% \global\@eqcnt\thr@@ \hb@xt@\z@\bgroup\hss##\egroup\tabskip\z@skip\cr} } % \end{macrocode} % If other options were asked for, the package should make % these options `unused'. Then, last, the option(s) % is (are) processed. % \begin{macrocode} \DeclareOption*{\OptionNotUsed} \ProcessOptions % \end{macrocode} % That is all. Happy \TeX-ing! % \iffalse % END of it all! % %<*exempelkod> \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@sssk.se http://www.homenet.se/matsd/}). 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} % % \fi % % \Finale % \endinput