Annotation of OpenXM/doc/Papers/subeqnar.sty, Revision 1.1
1.1 ! noro 1: % $OpenXM$
! 2: % subeqnary.sty - Copyright (C) 1996 by Frank Holzwarth to
! 3: % establish a new environment "subeqnarray" that locally numbers
! 4: % the lines of an equation array with the same number (default
! 5: % chapter.equation) and a running alphabetic suffix.
! 6: % \label-ing works ok. There is no "subeqnarray*" but \nonumber
! 7: % can be used.
! 8: %
! 9: % This is a hacked again version of:
! 10: % modeqary.sty - Copyright (C) 1991 by James Darrell McCauley
! 11: % modify freely - but this is just a hack, so you'd be better
! 12: % off going back to the original source (see below)
! 13:
! 14: % parts taken from latex.tex
! 15: % LATEX VERSION 2.09 <4 Aug 1988>
! 16: % Copyright (C) 1988 by Leslie Lamport
! 17:
! 18: % In response to:
! 19: %Hi netters,
! 20: % In book style I want to number the equations within the eqnarray
! 21: %environment differently. All I want to do is to number the equations
! 22: %some thing like 1.8a, 1.8b....etc instead of 1.8, 1.9 ...etc.
! 23: %Is there a way to this ?
! 24: %The result I am getting now with eqnarray;
! 25: %a= c + d (1.1)
! 26: %e= f - d (1.2)
! 27: %Instead I want to get;
! 28: %a= c + d (1.1a)
! 29: %e= f - d (1.1b)
! 30:
! 31: % SEE EOF FOR THE TEST PROGRAM THAT I USED.
! 32:
! 33: \newcounter{eqsubcnt}
! 34: \def\thesubequation{\thechapter.\arabic{equation}\alph{eqsubcnt}}
! 35:
! 36: \def\@eqnsubnum{{\rm (\thesubequation)}}
! 37:
! 38: % Here's the eqnarray environment:
! 39: % Default is for left-hand side of equations to be flushleft.
! 40: % To make them flushright, \let\@eqnsel = \hfil
! 41:
! 42: \newcount\@eqcnt
! 43: \newcount\@eqpen
! 44: \newif\if@eqnsw\@eqnswtrue
! 45:
! 46: \@centering = 0pt plus 1000pt % Changed 11/4/85 to produce warning message
! 47: % if line extends into margin. Doesn't warn
! 48: % about formula overprinting equation number.
! 49:
! 50: \def\subeqnarray{\stepcounter{equation}\let\@currentlabel=\thesubequation
! 51: \def\@eqncr{{\ifnum0=`}\fi\@ifstar{\global\@eqpen\@M
! 52: \@yeqncr}{\global\@eqpen\interdisplaylinepenalty \@yeqncr}}
! 53: %
! 54: \def\@yeqncr{\@ifnextchar [{\@xeqncr}{\@xeqncr[\z@]}}
! 55: %
! 56: \def\@xeqncr[##1]{\ifnum0=`{\fi}\@@eqncr
! 57: \noalign{\penalty\@eqpen\vskip\jot\vskip ##1\relax}}
! 58: %
! 59: \def\@@eqncr{\let\@tempa\relax
! 60: \ifcase\@eqcnt \def\@tempa{& & &}\or \def\@tempa{& &}
! 61: \else \def\@tempa{&}\fi
! 62: \@tempa \if@eqnsw\@eqnsubnum\stepcounter{eqsubcnt}\fi
! 63: \global\@eqnswtrue\global\@eqcnt\z@\cr}
! 64: \setcounter{eqsubcnt}{1}
! 65: \global\@eqnswtrue\m@th
! 66: \global\@eqcnt\z@
! 67: \let\\\@eqncr
! 68: \@ifundefined{mathindent}{\tabskip\@centering
! 69: $$\halign to\displaywidth}{\tabskip\mathindent
! 70: \abovedisplayskip\topsep\ifvmode\advance\abovedisplayskip\partopsep\fi
! 71: \belowdisplayskip\abovedisplayskip
! 72: \belowdisplayshortskip\abovedisplayskip
! 73: \abovedisplayshortskip\abovedisplayskip
! 74: $$\halign to\linewidth}\bgroup\@eqnsel\hskip\@centering
! 75: $\displaystyle\tabskip\z@
! 76: {##}$&\global\@eqcnt\@ne \hskip 2\arraycolsep \hfil${##}$\hfil
! 77: &\global\@eqcnt\tw@ \hskip 2\arraycolsep $\displaystyle{##}$\hfil
! 78: \tabskip\@centering&\llap{##}\tabskip\z@\cr}
! 79:
! 80: \def\endsubeqnarray{\@@eqncr\egroup
! 81: \global\advance\c@equation\m@ne$$\global\@ignoretrue
! 82: \stepcounter{equation}}
! 83:
! 84: \let\@eqnsel=\relax
! 85:
! 86: \def\nonumber{\global\@eqnswfalse}
! 87:
! 88:
! 89: \endinput
! 90:
! 91: \documentstyle[modeqnarray]{book}
! 92: \begin{document}
! 93: \chapter{Introduction}
! 94: \begin{eqnarray}
! 95: a & = & c + d \\
! 96: e & = & f - d
! 97: \end{eqnarray}
! 98:
! 99: \begin{equation}
! 100: O_i = \sum_{j=1}^N I_j W_{ij}
! 101: \end{equation}
! 102: \end{document}
! 103:
! 104: --
! 105: James Darrell McCauley, Grad Res Asst, Spatial Analysis Lab
! 106: Dept of Ag Engr, Texas A&M Univ, College Station, TX 77843-2117, USA
! 107: (jdm5548@diamond.tamu.edu, jdm5548@tamagen.bitnet)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>