1
\documentclass{article}
6
\showboxbreadth\maxdimen
11
% --- Switch allocations ---
16
% --- Dimen allocations ---
18
\newdimen\eqa@thiscolwd
19
\newdimen\eqa@maxcolwd
21
\newdimen\eqa@maxcoleqwd
23
% --- Main environments ---
26
\def\eqa@defnumber{(\theequation)\stepcounter{equation}}%
27
\let\eqa@defmarker\eqa@fullmarker%
33
\noalign{\global\dimen@i\prevdepth}%
34
\multispan\tab@columns\hfill\vrule\@depth\dimen@i\cr%
39
{\scrollmode\showbox\z@}%
42
\def\eqa@equations#1{%
44
% Set up restoring of things.
46
\toks@\expandafter{\eqa@number}%
47
\toks\tw@\expandafter{\eqa@marker}%
49
\gdef\noexpand\eqa@number{\the\toks@}%
50
\gdef\noexpand\eqa@marker{\the\toks\tw@}%
51
\eqa@maxcolwd\the\eqa@maxcolwd%
52
\eqa@maxcoleqwd\the\eqa@maxcoleqwd%
53
\eqa@maxeqwd\the\eqa@maxeqwd%
56
% Initialise numbering things.
58
\global\let\eqa@number\eqa@defnumber%
59
\global\let\eqa@marker\eqa@defmarker%
62
% Parse the preamble string. Put measuring things in the right places.
65
\def\tab@tabtext{&\tabskip\z@skip}%
67
\tab@append\tab@preamble{\let\eqa@measure\eqa@domeasure}%
69
\def\eqa@seteqcol##1{%
71
\if@leqno\let\eqa@seteqcol\relax\fi%
76
\tab@prepend\tab@pretext{\let\eqa@measure\eqa@domeasure}%
80
% Setting the newline command and some other initialisation.
83
\global\eqa@maxcolwd\z@%
84
\global\eqa@maxcoleqwd\z@%
85
\global\eqa@maxeqwd\z@%
87
% Start the box. Hacking to make \prevdepth work properly.
89
\setbox\z@\vbox\expandafter\bgroup%
90
\expandafter\prevdepth\the\prevdepth%
93
% And now the alignment.
96
\halign\expandafter\bgroup\the\tab@preamble\cr%
99
% --- Column building things ---
101
\def\eqa@aligncol#1#2#3{%
103
\ifx l#1\eqa@aligncol@i{#2#3}{#2\hfil}\else%
104
\ifx c#1\eqa@aligncol@i{\hfil#2#3}{#3#2\hfil}\else%
105
\ifx r#1\eqa@aligncol@i{\hfil#2}{#3#2}%
108
\def\eqa@aligncol@i#1#2{%
110
{\setbox\z@\hbox\bgroup#1}%
111
{#2\egroup\eqa@measure}%
116
\coldef l{\eqa@aligncol l${{}}}
117
\coldef c{\eqa@aligncol c${{}}}
118
\coldef r{\eqa@aligncol r${{}}}
120
\coldef M#1{\eqa@aligncol{#1}${{}}}
121
\coldef T#1{\eqa@aligncol{#1}{}{}}
125
% --- Equation measuring macros ---
127
\let\eqa@number\relax
128
\let\eqa@marker\relax
131
\global\let\eqa@marker\eqa@fullmarker%
132
\gdef\eqa@number{#1}%
136
\global\let\eqa@marker\eqa@nonummarker%
137
\global\let\eqa@number\@empty%
140
\def\eqa@measure{\unhbox\z@}
142
\global\eqa@thiscolwd\wd\z@%
143
\ifdim\eqa@maxcolwd<\eqa@thiscolwd%
144
\global\eqa@maxcolwd\eqa@thiscolwd%
149
% --- The newline command ---
151
\def\eqa@cr{\tab@cr\eqa@cr@i\z@\@M}
156
\global\let\eqa@number\eqa@defnumber%
157
\global\let\eqa@marker\eqa@defmarker%
158
\penalty\eqa@markpen%
162
\def\eqa@fullmarker#1#2{%
164
\vskip\eqa@thiscolwd%
166
\skip@#1\advance\skip@\jot%
168
\setbox\z@\hbox{\eqa@number}%
169
\dimen@\eqa@thiscolwd\advance\dimen@\wd\z@%
170
\ifdim\dimen@\eqa@maxcoleqwd<\dimen@%
171
\global\eqa@maxcoleqwd\dimen@%
172
\global\eqa@maxeqwd\wd\z@%
174
\nointerlineskip\hb@xt@\z@{\hbox{\eqa@number}}%
178
\def\eqa@nonummarker#1#2{%
180
\skip@#1\advance\skip@\jot%
182
\penalty\eqa@markpen%
185
% --- Offset calculation ---
187
% This stuff is sort of like the standard offset calculation, only it's
190
\def\eqa@offsetcalc{%
193
\csname eqa@calc:\eqa@eqcol\expandafter\noexpand\if@leqno\endcsname%
196
\@namedef{eqa@calc:l\noexpand\iffalse}{%
199
% --- Test document ---
205
\setcounter{equation}{23}
207
\begin{equations}{rrl}