% \polyalignno {}{} % % There are 2 * + 1 alignment columns that alternate % between right & left justified; plus there is a column for the equation % number: "". % % is any number of: % = [ & & ] \cr % where the contents of [ ] are repeated times, and % = math that will be right justified (e.g., 2y) % = math that will be left justified (e.g., +,-,=) % are one of: % \eqno... % \leqno... % \eqno...\leqno... % & explicit numbering % The \eqno and \leqno forms will automatically insert just enough &'s % to get to the final column, but you can also enter enough &'s to get % to the final column manually. Note that the equations are centered % on the page, even if they overlap the label. % \edef\ResetCatOfAt{\the\catcode`\@} \catcode`\@=11 \def\polyleqno{\movetofinalcolumn \kern-\displaywidth \hbox to\z@\bgroup\bgroup\aftergroup\polyXleqno$} \def\polyXleqno{\hss\egroup\kern\displaywidth$\egroup} \def\p@l@ntry{\toks@=\expandafter{\the\toks@ &$\@lign\displaystyle{}##{}$\hfil &\hfil$\@lign\displaystyle##$}} \def\movetofinalcolumn{\relax \if@morecolumns \expandafter\movetonextcolumn \fi } \def\movetonextcolumn{&\movetofinalcolumn} \def\polyalignno#1#2{% \let\if@morecolumns\iftrue \toks@{}% \looseness#1\relax % \looseness is a scratch counter \loop \p@l@ntry \advance\looseness\m@ne \ifnum\looseness>\z@ \repeat \let\\\cr % can use \\ or \cr \let\eqno\movetofinalcolumn \let\leqno\polyleqno \displ@y \tabskip \centering \halign to\displaywidth {\tabskip\z@skip \hfil$\@lign\displaystyle##$% \span\the\toks@ \tabskip\centering &\let\if@morecolumns\iffalse \tabskip\z@skip\@lign \hbox to\z@\bgroup\hss$##$\egroup\crcr #2\crcr}% } \ResetCatOfAt \let\ResetCatOfAt\UnderfIned % Donald Arseneau % asnd@reg.triumf.ca ================================================== % % -------- Examples ------------ % \def\\{$\backslash$} Test with constant on left, and one label on the left. Note how a premature \\cr is OK $$ \polyalignno3{ 99&=& 17x&+& 7y&-&2z\cr 9&=&117x&-& 2y&-&z\leqno 1.0\cr 33&=& 3x&+&77y\cr} $$ \\\\ can substitute for \\cr, and a premature \\eqno works too $$ \polyalignno3{ 99&=& 17x&+& 7y&-&2z\\ 9&=&117x&-& 2y\eqno{\rm WORKS}\\ 33&=& 3x&+&77y\\} $$ Test with constant on left, numbers on right, and a label for the lot. $$ \polyalignno3{ 99&=& 17x&+& 7y&-&2z\eqno 1.1a\\ 9&=&117x&-& 2y&-&z\eqno 1.1b\leqno 1.1\\ 33&=& 3x&+&77y \eqno 1.1c} $$ Try again with constants left justified on the right, and with left equation numbers. $$ \polyalignno3{ 17x&+&7y&-&2z&=6\leqno{1{-}2a}\\ 117x&-&2y&-&z&=-2\leqno{1{-}2b}\\ 3x &+&77y&&&=12\leqno{1{-}2c}\\} $$ And finally with right justified constants on the right. $$ \polyalignno4{% Extra pair of columns is *unused* 17x&+&7y&-&2z&=&6\eqno(1.3a)\\ 117x&-&2y&-&z&=&-2\eqno(1.3b)\\ 3x &+&77y&&&=&12\eqno(1.3c) } $$ Try with no \\eqno, just \& $$ \polyalignno4{ 0 &=& 4x^3 &-& 6x^2 &+& 3x &+& 1& (1.2.3.4.5.6.7.8.9.a)\cr 0 &=& 5x^3 &+&11x^2 & & &-& 7& (1.2.3.4.5.6.7.8.9.b)\cr } $$ and finished. \bye % - - - - - - - - - - - - - - - - - - - - - - - % Donald Arseneau % asnd@reg.triumf.ca