home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fonts 1 / freshfonts1.bin / bbs / programs / amiga / pastex13.lha / Macros / SUBEQN / subeqnarray.sty < prev   
Text File  |  1989-12-20  |  3KB  |  87 lines

  1. %+
  2. % Subeqnarray DOCUMENT-STYLE option -- Version 1.1 released 15 November 1988
  3. %    for LaTeX version 2.09
  4. %
  5. % Copyright (C) 1988 by Johannes Braams, Dr Neher Laboratories
  6. %
  7. %    This style option defines the subeqnarray and subeqnarray*
  8. %    environment, which behaves like the eqnarray environment,
  9. %    except that the lines are numbered like 1a 1b 1c etc.
  10. %    To refer to these numbers an extra label command \slabel
  11. %    has been defined.
  12. %
  13. %    Many of this code was taken from LaTeX.TeX and modified for
  14. %    this purpose.
  15. %
  16. % Revisions:
  17. %
  18. %    22 December 1988    V1.1    JB    Fixed bug in subeqnarray* environment
  19. %
  20. %-
  21. \typeout{Documentstyle option `subeqnarray' V1.1;  Released 22 December 1988}
  22. %
  23. %    A new counter for he subequations
  24. %    and a command to generate the number
  25. %
  26. \newcounter{subequation}[equation]
  27. \def\thesubequation{\theequation\@alph\c@subequation}
  28. %
  29. %  \@subeqnnum: Produces the equation number for the
  30. %     subeqnarray environment.  The following definition is for
  31. %     flushright numbers; for flushleft numbers, see leqno.doc.
  32. %     The {\rm ... } puts the subequation number in roman type even if
  33. %     an subeqnarray environment appears in an italic environment.
  34. %
  35. \def\@subeqnnum{{\rm (\thesubequation)}}
  36. %
  37. %    A new label command to refer to subequations. It works
  38. %    like the \label command and was taken from LaTeX.TeX
  39. %
  40. %  \slabel{FOO} then writes the following on file \@auxout :
  41. %        \newlabel{FOO}{{eval(\@currentlabel)}{eval(\thepage)}}
  42. %
  43. \def\slabel#1{\@bsphack\if@filesw {\let\thepage\relax
  44.    \xdef\@gtempa{\write\@auxout{\string
  45.       \newlabel{#1}{{\thesubequation}{\thepage}}}}}\@gtempa
  46.    \if@nobreak \ifvmode\nobreak\fi\fi\fi\@esphack}
  47. %
  48. %    Here's the subeqnarray environment,
  49. %        it steps the equation counter,
  50. %        sets the subequation counter equal to 1
  51. %        and behaves much like the eqnarray environment.
  52. %
  53. \def\subeqnarray{\stepcounter{equation}
  54. \let\@currentlabel=\theequation\global\c@subequation\@ne
  55. \global\@eqnswtrue
  56. \global\@eqcnt\z@\tabskip\@centering\let\\=\@subeqncr
  57. $$\halign to \displaywidth\bgroup\@eqnsel\hskip\@centering
  58.   $\displaystyle\tabskip\z@{##}$&\global\@eqcnt\@ne
  59.   \hskip 2\arraycolsep \hfil${##}$\hfil
  60.   &\global\@eqcnt\tw@ \hskip 2\arraycolsep $\displaystyle\tabskip\z@{##}$\hfil
  61.    \tabskip\@centering&\llap{##}\tabskip\z@\cr}
  62.  
  63. \def\endsubeqnarray{\@@subeqncr\egroup
  64.                      $$\global\@ignoretrue}
  65.  
  66. \def\@subeqncr{{\ifnum0=`}\fi\@ifstar{\global\@eqpen\@M
  67.     \@ysubeqncr}{\global\@eqpen\interdisplaylinepenalty \@ysubeqncr}}
  68.  
  69. \def\@ysubeqncr{\@ifnextchar [{\@xsubeqncr}{\@xsubeqncr[\z@]}}
  70.  
  71. \def\@xsubeqncr[#1]{\ifnum0=`{\fi}\@@subeqncr
  72.    \noalign{\penalty\@eqpen\vskip\jot\vskip #1\relax}}
  73.  
  74. \def\@@subeqncr{\let\@tempa\relax
  75.     \ifcase\@eqcnt \def\@tempa{& & &}\or \def\@tempa{& &}
  76.       \else \def\@tempa{&}\fi
  77.      \@tempa \if@eqnsw\@subeqnnum\refstepcounter{subequation}\fi
  78.      \global\@eqnswtrue\global\@eqcnt\z@\cr}
  79.  
  80. % Here's the subeqnarray* environment:
  81.  
  82. \let\@ssubeqncr=\@subeqncr
  83. \@namedef{subeqnarray*}{\def\@subeqncr{\nonumber\@ssubeqncr}\subeqnarray}
  84. \@namedef{endsubeqnarray*}{\global\advance\c@equation\m@ne%
  85.                            \nonumber\endsubeqnarray}
  86.  
  87.