X-Git-Url: https://git.distorted.org.uk/~mdw/mdwtools/blobdiff_plain/b57a27e1141e4396549f7a3528a29d65b0f44973..9d809eaca2b424a34222f8912d58d476720ffa24:/mdwtab.dtx diff --git a/mdwtab.dtx b/mdwtab.dtx index 0b78153..5f863b2 100644 --- a/mdwtab.dtx +++ b/mdwtab.dtx @@ -6,31 +6,6 @@ % % (c) 1996 Mark Wooding % -%----- Revision history ----------------------------------------------------- -% -% $Log: mdwtab.dtx,v $ -% Revision 1.3 2003/11/10 14:43:48 mdw -% Ignore spaces after spliteqn. -% -% Revision 1.2 2003/09/05 16:15:03 mdw -% Colour support! Better rule attribute handling. Lots of new hooks. -% -% Revision 1.1 2002/02/03 20:49:03 mdw -% Checkin for new build system. -% -% Revision 1.8 1996/12/09 23:20:42 mdw -% (\tab@setstrut): Fixed so that it uses \dimen@ii for the strut depth, -% as advertised. -% -% Revision 1.7 1996/11/29 21:59:16 mdw -% Fixed a little formatting mistake in a syntax diagram, and switched over -% to the new syntax diagram commands on the grounds that they're slightly -% less messy. Maybe. -% -% Revision 1.6 1996/11/19 20:54:33 mdw -% Entered into RCS -% -% % \end{meta-comment} % % \begin{meta-comment} @@ -69,7 +44,7 @@ %<+color> [2003/08/24 1.10 Fix for people who can't spell] % \end{meta-comment} % -% \CheckSum{3373} +% \CheckSum{3402} %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -249,7 +224,7 @@ % % \item David Carlisle's \package{colortbl} package entirely fails to work % with \package{mdwtab}. However, we now have colour support of our -% own which is at times similar in style. +% own which is at times similar in style. % % \end{itemize} % @@ -295,7 +270,7 @@ % % \begin{grammar} % -% ::= \[[ +% ::= \[[ % "\\begin" % \begin{stack} % "{tabular}" \\ "{tabular*}" "{" "}" \\ @@ -309,23 +284,23 @@ % % ::= (see below) % -% ::= \[[ +% ::= \[[ % % \[ \< \> \] % \]] % % ::= \[[ \[ \] \]] % -% ::= \[[ +% ::= \[[ % \[ \] \[ \< \> \] % \[ \< \> \] \[ \] \[ \] % \]] % -% ::= \[[ "@" "{" "}" \]] +% ::= \[[ "@" "{" "}" \]] % % ::= \[[ \[ "?" \] ">" "{" "}" \]] % -% ::= \[[ +% ::= \[[ % \begin{stack} % \[ "T" \\ "M" \] \( "l" \\ "c" \\ "r" \) \\ % \( "p" \\ "m" \\ "b" \) "{" "}" \\ @@ -335,7 +310,7 @@ % % ::= \[[ \[ "?" \] "<" "{" "}" \]] % -% ::= \[[ \( "|" \\ "!" "{" "}" \) \]] +% ::= \[[ \( "|" \\ "!" "{" "}" \) \]] % % \end{grammar} % @@ -352,53 +327,53 @@ % The actual column types are shown in table~\ref{tbl:columns}. % % \begin{table} -% \begin{tabular}[C]{| >{\synshorts} c | m{3in} |} \hlx{hv[1]} -% -% \multicolumn{2}{|c|}{\bf Column types} \\ \hlx{v[1]hv} -% \bf Name & \bf Meaning \\ \hlx{vhv.} -% "l" & Left aligned text (\env{tabular}) or -% equation (\env{array}). \\ \hlx{.} -% "c" & Centred text (\env{tabular}) or -% equation (\env{array}). \\ \hlx{.} -% "r" & Right aligned text (\env{tabular}) or -% equation (\env{array}). \\ \hlx{vhv.} +% \begin{tabular}[C]{| >{\synshorts} c | m{3in} |} \hlx{hv[1]} +% +% \multicolumn{2}{|c|}{\bf Column types} \\ \hlx{v[1]hv} +% \bf Name & \bf Meaning \\ \hlx{vhv.} +% "l" & Left aligned text (\env{tabular}) or +% equation (\env{array}). \\ \hlx{.} +% "c" & Centred text (\env{tabular}) or +% equation (\env{array}). \\ \hlx{.} +% "r" & Right aligned text (\env{tabular}) or +% equation (\env{array}). \\ \hlx{vhv.} % "Ml", "Mc" and "Mr" & Left, centre and right aligned -% equations.* \\ \hlx{.} +% equations.* \\ \hlx{.} % "Tl", "Tc" and "Tr" & Left, centre and right aligned -% text.* \\ \hlx{vhv.} +% text.* \\ \hlx{vhv.} % "p{""}" & Top aligned paragraph with the given -% width. \\ \hlx{.} +% width. \\ \hlx{.} % "m{""}" & Vertically centred paragraph with -% the given width. \\ \hlx{.} +% the given width. \\ \hlx{.} % "b{""}" & Bottom aligned paragraph with the -% given width. \\ \hlx{vhv.} +% given width. \\ \hlx{vhv.} % "#{"
"}{""}" & User defined column type:
-%		  \
 is inserted before the
-%		  cell entry, \ is inserted
-%		  afterwards.*				\\ \hlx{vhhv[1]}
-%
-% \multicolumn{2}{|c|}{\bf Other modifier characters}	\\ \hlx{v[1]hv}
-% \bf Name	& \bf Meaning				\\ \hlx{vhv.}
-% "|"		& Inserts a vertical rule between
-%		  columns.				\\ \hlx{.}
+%                 \
 is inserted before the
+%                 cell entry, \ is inserted
+%                 afterwards.*                          \\ \hlx{vhhv[1]}
+%
+% \multicolumn{2}{|c|}{\bf Other modifier characters}   \\ \hlx{v[1]hv}
+% \bf Name      & \bf Meaning                           \\ \hlx{vhv.}
+% "|"           & Inserts a vertical rule between
+%                 columns.                              \\ \hlx{.}
 % "$*[""]" & Inserts a vertical rule of given
 %                 width between columns; "*" selects
 %                 "\arraythickrulewidth".*              \\ \hlx{.}
-% "!{""}"	& Inserts \ between columns,
-%		  treating it as a vertical rule.	\\ \hlx{vhv.}
-% "@{""}"	& Inserts \ instead of the
-%		  usual intercolumn space.		\\ \hlx{vhv.}
-% ">{""}"	& Inserts \ just before the
-%		  actual column entry.			\\ \hlx{.}
-% "<{""}"	& Inserts \ just after the
-%		  actual column entry.			\\ \hlx{.}
+% "!{""}" & Inserts \ between columns,
+%                 treating it as a vertical rule.       \\ \hlx{vhv.}
+% "@{""}" & Inserts \ instead of the
+%                 usual intercolumn space.              \\ \hlx{vhv.}
+% ">{""}" & Inserts \ just before the
+%                 actual column entry.                  \\ \hlx{.}
+% "<{""}" & Inserts \ just after the
+%                 actual column entry.                  \\ \hlx{.}
 % "?<{""}" & Inserts \ before the column
 %                 entry \emph{and} the rules list.*     \\ \hlx{.}
 % "?>{""}" & Inserts \ after the column
 %                 entry \emph{and} the rules list.*     \\ \hlx{vhv.}
 % "*{""}{""}" & Inserts \
-%		  copies of the \ into the
-%		  preamble.				\\ \hlx{vhs}
+%                 copies of the \ into the
+%                 preamble.                             \\ \hlx{vhs}
 %
 % \multicolumn{2}{@{}l}{* This column type is a new feature}
 % \end{tabular}
@@ -471,7 +446,7 @@
 % separated list of column numbers and ranges:
 %
 % \begin{grammar}
-% 	::= \[[
+%    ::= \[[
 %   "\\cline"
 %   \[ "*" \] \\ \[ "["  "]" \]
 %   "{" \<  \[ "-"  \] \\ "," \> "}"
@@ -521,11 +496,11 @@
 %
 % \begin{grammar}
 %
-% 	::= \[[
+%     ::= \[[
 %   "\\vgap" \[ "["  "]" \] "{"  "}"
 % \]]
 %
-% 	::= \[[ \<  \[ "-"  \] \\ "," \> \]]
+%   ::= \[[ \<  \[ "-"  \] \\ "," \> \]]
 %
 % \end{grammar}
 %
@@ -552,7 +527,7 @@
 % The syntax is simple:
 % \begin{grammar}
 %
-% 	::= \[[
+%      ::= \[[
 %   "\\hlx"
 %   \[ "*" \] \[ "["  "]" \]
 %   "{"
@@ -578,7 +553,7 @@
 % The |*| or optional \ give rule-drawing parameters for the |h|
 % and |c| subcommands.  (Note that you can't pass a |*| or an optional
 % parameters argument to the |h| or |c| subcommands directly.)  See
-% section~\ref{sec:ruleparams}. 
+% section~\ref{sec:ruleparams}.
 %
 % The argument works a bit like a table preamble, really.  Each letter is a
 % command.  The following are supported:
@@ -595,8 +570,8 @@
 %
 % \item [\lit*{z[}\\lit*{][}\\lit*{]}]  Like \lit{v},
 %       except that the default gap is the current rule width (set by the
-%	\) rather than |\doublerulesep|.  This is a good thing
-%	to insert before a |\cline| row.
+%       \) rather than |\doublerulesep|.  This is a good thing
+%       to insert before a |\cline| row.
 %
 % \item [\lit*{s[}\\lit*{]}]  Leaves a vertical gap with the
 %       given size.  If you omit the \ then |\doublerulesep| is
@@ -676,7 +651,7 @@
 % then you get an extra thick rule at the bottom of the page.  This is a bit
 % of a problem, because if the rule isn't there in the footer and you get
 % a break between two rows \emph{without} a rule between them, then the page
-% looks very odd.  
+% looks very odd.
 %
 % If you want to do ruled longtables, I'd recommend that you proceed as
 % follows:
@@ -766,48 +741,48 @@
 % and tables look nicer.  They are all listed in table~\ref{tbl:config}.
 %
 % \begin{table}
-% \begin{tabular}[C]{| l | m{3in} |}				   \hlx{hv}
-% \bf Parameter		& \bf Meaning				\\ \hlx{vhv}
-% |\tabstyle|		& A command executed at the beginning of
-%			  a \env{tabular} or \env{tabular$*$}
-%			  environment.  By default does nothing.
-%			  Change using |\renewcommand|.		\\ \hlx{vhv}
-% |\extrarowheight|	& A length added to the height of every
-%			  row, used to stop table rules
-%			  overprinting ascenders.  Default 0\,pt.
-%			  Usage is deprecated now: use |\hlx|
-%			  instead.				\\ \hlx{vhv}
-% |\tabextrasep|	& Extra space added between rows in a
-%			  \env{tabular} or \env{tabular$*$}
-%			  environment (added \emph{before} any
-%			  following |\hline|).  Default 0\,pt.	\\
-% |\arrayextrasep|	& Analogous to |\tabextrasep|, but for
-%			  \env{array} environments.  Default
-%			  1\,jot (3\,pt).			\\
-% |\smarrayextrasep|	& Analogous to |\tabextrasep|, but for
-%			  \env{smarray} environments.  Default
-%			  1\,pt.				\\ \hlx{vhv}
-% |\tabcolsep|		& Space added by default on each side of
-%			  a table cell (unless suppressed by an
-%			  \lit{@}-expression) in \env{tabular}
-%			  environments.  Default is defined by
-%			  your document class.			\\
-% |\arraycolsep|	& Analogous to |\tabcolsep|, but for
-%			  \env{array} environments.  Default is
-%			  defined by your document class.	\\
-% |\smarraycolsep|	& Analogous to |\tabcolsep|, but for
-%			  \env{smarray} environments.  Default
-%			  is 3\,pt.				\\ \hlx{vhv}
-% |\arrayrulewidth|	& The width of horizontal and vertical
-%			  rules in tables.			\\
-% |\arraythickrulewidth|& The width of starred rules in tables.	\\
-% |\doublerulesep|	& Space added between two adjacent
-%			  vertical or horizontal rules.  Also
-%			  used by |\hlx{v}|.			\\ \hlx{vhv}
-% |\arraystretch|	& Command containing a factor to
-%			  multiply the default row height.
-%			  Default is defined by your document
-%			  class (usually 1).			\\ \hlx{vh}
+% \begin{tabular}[C]{| l | m{3in} |}                               \hlx{hv}
+% \bf Parameter         & \bf Meaning                           \\ \hlx{vhv}
+% |\tabstyle|           & A command executed at the beginning of
+%                         a \env{tabular} or \env{tabular$*$}
+%                         environment.  By default does nothing.
+%                         Change using |\renewcommand|.         \\ \hlx{vhv}
+% |\extrarowheight|     & A length added to the height of every
+%                         row, used to stop table rules
+%                         overprinting ascenders.  Default 0\,pt.
+%                         Usage is deprecated now: use |\hlx|
+%                         instead.                              \\ \hlx{vhv}
+% |\tabextrasep|        & Extra space added between rows in a
+%                         \env{tabular} or \env{tabular$*$}
+%                         environment (added \emph{before} any
+%                         following |\hline|).  Default 0\,pt.  \\
+% |\arrayextrasep|      & Analogous to |\tabextrasep|, but for
+%                         \env{array} environments.  Default
+%                         1\,jot (3\,pt).                       \\
+% |\smarrayextrasep|    & Analogous to |\tabextrasep|, but for
+%                         \env{smarray} environments.  Default
+%                         1\,pt.                                \\ \hlx{vhv}
+% |\tabcolsep|          & Space added by default on each side of
+%                         a table cell (unless suppressed by an
+%                         \lit{@}-expression) in \env{tabular}
+%                         environments.  Default is defined by
+%                         your document class.                  \\
+% |\arraycolsep|        & Analogous to |\tabcolsep|, but for
+%                         \env{array} environments.  Default is
+%                         defined by your document class.       \\
+% |\smarraycolsep|      & Analogous to |\tabcolsep|, but for
+%                         \env{smarray} environments.  Default
+%                         is 3\,pt.                             \\ \hlx{vhv}
+% |\arrayrulewidth|     & The width of horizontal and vertical
+%                         rules in tables.                      \\
+% |\arraythickrulewidth|& The width of starred rules in tables. \\
+% |\doublerulesep|      & Space added between two adjacent
+%                         vertical or horizontal rules.  Also
+%                         used by |\hlx{v}|.                    \\ \hlx{vhv}
+% |\arraystretch|       & Command containing a factor to
+%                         multiply the default row height.
+%                         Default is defined by your document
+%                         class (usually 1).                    \\ \hlx{vh}
 % \end{tabular}
 %
 % \caption{Parameters for configuring table environments}
@@ -841,7 +816,7 @@
 % This implementation allows you to define lots of different sets of columns.
 % You can change the current set using the |\colset| declaration:
 % \begin{grammar}
-% 	::= \[[ "\\colset" "{"  "}" \]]
+%   ::= \[[ "\\colset" "{"  "}" \]]
 % \end{grammar}
 % This leaves a problem, though: at any particular moment, the current
 % column set could be anything, since other macros and packages can change
@@ -857,8 +832,8 @@
 % previous current column set.
 %
 % \begin{grammar}
-% 	::= \[[ "\\colpush" "{"  "}" \]]
-% 	::= \[[ "\\colpop" \]]
+%  ::= \[[ "\\colpush" "{"  "}" \]]
+%   ::= \[[ "\\colpop" \]]
 % \end{grammar}
 %
 % The macros which manipulate the column set stack work \emph{locally}.
@@ -894,7 +869,7 @@
 % something lower-level.
 %
 % \begin{grammar}
-% 	::= \[[
+%   ::= \[[
 %   "\\coldef"
 %     \[ "["  "]" \]
 %       "{"  "}"
@@ -915,7 +890,7 @@
 % Note that if you do gobble the |\tab@mkpream|, it's your responsibility to
 % insert another one at the very end of your macro's expansion (so that
 % further preamble characters can be read).
-% 
+%
 % The replacement text is inserted directly.  It's normal to insert preamble
 % elements here.  There are several to choose from:
 %
@@ -954,7 +929,7 @@
 %
 % \begin{grammar}
 %
-% 	::= \[[
+%   ::= \[[
 %   \[ "["  "]" \]  \[ "=" \] \[ "["  "]" \]
 %   
 % \]]
@@ -1054,7 +1029,7 @@
 % using the |\tab@cr| command:
 %
 % \begin{grammar}
-% 	::= \[[
+%    ::= \[[
 %   "\\tab@cr"  "{"  "}" "{"  "}"
 % \]]
 % \end{grammar}
@@ -1107,7 +1082,7 @@
 %   \[ "*" \]
 %   \[ "["  "]" \]
 %   "{"  "}"
-%   \[ "["  "]" 
+%   \[ "["  "]"
 %      \[ "["  "]" \] \]
 % \]]
 % \end{grammar}
@@ -1262,7 +1237,7 @@
 %   \[ "[" \<  \> "]" \]
 % \]]
 %
-% 	::= \[[
+%   ::= \[[
 %   \[ "q" \\ ":" \]
 %   \[ \< ">" "{"  "}" \> \]
 %   \begin{stack}
@@ -1283,34 +1258,34 @@
 % table~\ref{tbl:eqnarray}.
 %
 % \begin{table}
-% \begin{tabular}[C]{| >{\synshorts} c | m{3in} |}	   \hlx{hv[1]}
-%
-% \multicolumn{2}{|c|}{\bf Column types}		\\ \hlx{v[1]hv}
-% \bf Name	& \bf Meaning				\\ \hlx{vhv.}
-% "l"		& Left aligned piece of equation.	\\ \hlx{.}
-% "c"		& Centred piece of equation.		\\ \hlx{.}
-% "x"		& Centred or flush-left whole equation
-%		  (depending on \textsf{fleqn} option).	\\ \hlx{.}
-% "r"		& Right aligned piece of equation.	\\ \hlx{vhv.}
-% "L"		& Left aligned piece of equation whose
-%		  width is considered to be 2\,em.	\\ \hlx{vhv.}
+% \begin{tabular}[C]{| >{\synshorts} c | m{3in} |}         \hlx{hv[1]}
+%
+% \multicolumn{2}{|c|}{\bf Column types}                \\ \hlx{v[1]hv}
+% \bf Name      & \bf Meaning                           \\ \hlx{vhv.}
+% "l"           & Left aligned piece of equation.       \\ \hlx{.}
+% "c"           & Centred piece of equation.            \\ \hlx{.}
+% "x"           & Centred or flush-left whole equation
+%                 (depending on \textsf{fleqn} option). \\ \hlx{.}
+% "r"           & Right aligned piece of equation.      \\ \hlx{vhv.}
+% "L"           & Left aligned piece of equation whose
+%                 width is considered to be 2\,em.      \\ \hlx{vhv.}
 % "Tl", "Tc" and "Tr" & Left, centre and right aligned
-%		  text.					\\ \hlx{vhhv[1]}
-%
-% \multicolumn{2}{|c|}{\bf Other modifier characters}	\\ \hlx{v[1]hv}
-% \bf Name	& \bf Meaning				\\ \hlx{vhv.}
-% ":"		& Leaves a big gap between equations.
-%		  By default, the `chunks' separated by
-%		  \lit{:}s are equally spaced on the
-%		  line.					\\ \hlx{.}
-% "q"		& Inserts 1\,em of space		\\ \hlx{vhv.}
-% ">{""}"	& Inserts \ just before the
-%		  actual column entry.			\\ \hlx{.}
-% "<{""}"	& Inserts \ just after the
-%		  actual column entry.			\\ \hlx{vhv.}
+%                 text.                                 \\ \hlx{vhhv[1]}
+%
+% \multicolumn{2}{|c|}{\bf Other modifier characters}   \\ \hlx{v[1]hv}
+% \bf Name      & \bf Meaning                           \\ \hlx{vhv.}
+% ":"           & Leaves a big gap between equations.
+%                 By default, the `chunks' separated by
+%                 \lit{:}s are equally spaced on the
+%                 line.                                 \\ \hlx{.}
+% "q"           & Inserts 1\,em of space                \\ \hlx{vhv.}
+% ">{""}" & Inserts \ just before the
+%                 actual column entry.                  \\ \hlx{.}
+% "<{""}" & Inserts \ just after the
+%                 actual column entry.                  \\ \hlx{vhv.}
 % "*{""}{""}" & Inserts \
-%		  copies of the \ into the
-%		  preamble.				\\ \hlx{vh}
+%                 copies of the \ into the
+%                 preamble.                             \\ \hlx{vh}
 % \end{tabular}
 %
 % \caption{\package{eqnarray} column types and modifiers}
@@ -1342,7 +1317,7 @@
 %
 % \begin{demo}[w]{Lots of equations}
 %\begin{eqnarray}[rl:rl:lq]
-% V_i &= v_i - q_i v_j,	& X_i &= x_i - q_i x_j,	&
+% V_i &= v_i - q_i v_j, & X_i &= x_i - q_i x_j, &
 %       U_i = u_i, \qquad \mbox{for $i \ne j$}  \\
 % V_j &= v_j,           & X_j &= x_j            &
 %       U_j u_j + \sum_{i \ne j} q_i u_i. \label{eq:A}
@@ -1558,31 +1533,31 @@
 % you like them.  These are all shown in table~\ref{tbl:eqnparms}.
 %
 % \begin{table}
-% \begin{tabular}[C]{| l | p{3in} |}				   \hlx{hv}
-% \bf Parameter		& \bf Use				\\ \hlx{vhv}
-% |\eqaopenskip|	& Length put on the left of an
-%			  \env{eqnarray} environment.  By
-%			  default, this is |\@centering| (to
-%			  centre the alignment) or |\mathindent|
-%			  (to left align) depending on whether
-%			  you're using the \textsf{fleqn}
-%			  document class option.		\\
-% |\eqacloseskip|	& Length put on the right of an
-%			  \env{eqnarray} environment.  By
-%			  default, this is |\@centering|, to
-%			  align the environment correctly.	\\ \hlx{vhv}
-% |\eqacolskip|		& Space added by the \lit{:} column
-%			  modifier.  This should be a rubber
-%			  length, although it only stretches in
-%			  \env{eqnarray}, not in \env{eqnalign}.
-%			  The default value is 1\smallf1/2\,em
-%			  with 1000\,pt of stretch.		\\
-% |\eqainskip|		& Space added at each side of a normal
-%			  column.  By default this is 0\,pt.	\\ \hlx{vhv}
-% |\eqastyle|		& The maths style used in the alignment.
-%			  By default, this is |\textstyle|,
-%			  and you probably won't want to change
-%			  it.					\\ \hlx{vh}
+% \begin{tabular}[C]{| l | p{3in} |}                               \hlx{hv}
+% \bf Parameter         & \bf Use                               \\ \hlx{vhv}
+% |\eqaopenskip|        & Length put on the left of an
+%                         \env{eqnarray} environment.  By
+%                         default, this is |\@centering| (to
+%                         centre the alignment) or |\mathindent|
+%                         (to left align) depending on whether
+%                         you're using the \textsf{fleqn}
+%                         document class option.                \\
+% |\eqacloseskip|       & Length put on the right of an
+%                         \env{eqnarray} environment.  By
+%                         default, this is |\@centering|, to
+%                         align the environment correctly.      \\ \hlx{vhv}
+% |\eqacolskip|         & Space added by the \lit{:} column
+%                         modifier.  This should be a rubber
+%                         length, although it only stretches in
+%                         \env{eqnarray}, not in \env{eqnalign}.
+%                         The default value is 1\smallf1/2\,em
+%                         with 1000\,pt of stretch.             \\
+% |\eqainskip|          & Space added at each side of a normal
+%                         column.  By default this is 0\,pt.    \\ \hlx{vhv}
+% |\eqastyle|           & The maths style used in the alignment.
+%                         By default, this is |\textstyle|,
+%                         and you probably won't want to change
+%                         it.                                   \\ \hlx{vh}
 % \end{tabular}
 %
 % \caption{Parameters for the \env{eqnarray} and \env{eqnalign} environments}
@@ -1653,15 +1628,15 @@
 %
 % \begin{grammar}
 %
-% 	::= \[[    \]]
+%   ::= \[[    \]]
 %
 %  ::= \[[ "\\begin{matrix}" \[ "["  "]" \] \]]
 %
-% 	::= \[[
+%  ::= \[[
 %   \< \[ "[" \] \[ "T" \] \( "l" \\ "c" \\ "r" \) \>
 % \]]
 %
-% 	::= \[[ "\\end{stack}" \]]
+%   ::= \[[ "\\end{stack}" \]]
 %
 % \end{grammar}
 %
@@ -1971,14 +1946,14 @@
 %
 %
 % \subsection{Parser states}
-% 
+%
 % Now we start on the parser.  It's really simple, deep down.  We progress
 % from state to state, extracting tokens from the preamble and building
 % command names from them.  Each command calls one of the element-building
 % routines, which works out which state it should be in.  We go through each
 % of the states in between (see later) doing default things for the ones we
 % missed out.
-% 
+%
 % Anyway, here's some symbolic names for the states.  It makes my life
 % easier.
 %
@@ -2077,7 +2052,7 @@
 % {\bf while} $\it tab\_state \ne s$ {\bf do} \\
 % \qq $\mathit{tab\_state = tab\_state}+1$; \\
 % \qq {\bf if} $\it tab\_state = tab\_limitState$ {\bf then}
-%				$\it tab\_state=tab\_loopState$; \\
+%                               $\it tab\_state=tab\_loopState$; \\
 % \qq {\bf if} $\it tab\_state = tab\_preSpcState$ {\bf then} \\
 % \qq \qq {\bf if} $\it tab\_initRule$ {\bf then} \\
 % \qq \qq \qq $\it tab\_initRule = {\bf false}$; \\
@@ -2088,7 +2063,7 @@
 % \qq \qq {\bf end\,if}; \\
 % \qq {\bf end\,if}; \\
 % \qq {\bf if} $\it tab\_state \ne s$ {\bf then}
-%				$\it do\_default(tab\_state)$; \\
+%                               $\it do\_default(tab\_state)$; \\
 % {\bf end\,while};
 % \end{quote}
 %
@@ -2739,7 +2714,7 @@
 \coldef <#1{\tabuserposttype{#1}}
 \coldef ?#1#2{%
   \ifx>#1\expandafter\tabuserpretype%
-  \else\expandafter\tabusrposttype\fi%
+  \else\expandafter\tabuserposttype\fi%
   {#2}%
   \tab@append\tab@shortline{#2}%
 }
@@ -2880,7 +2855,11 @@
   \tab@initread%
   \def\tab@multicol{\@arstrut}%
   \tab@preamble{\tab@multicol}%
-  \def\tab@midtext{\ignorespaces\@sharp\@sharp\@maybe@unskip}%
+  \let\tab@lefttext\tab@lefttexthook%
+  \let\tab@righttext\tab@righttexthook%
+  \let\tab@leftruletext\tab@leftruletexthook%
+  \let\tab@rightruletext\tab@rightruletexthook%
+  \def\tab@midtext{\tab@setcr\ignorespaces\@sharp\@sharp\@maybe@unskip}%
   \tab@readpreamble{#1}%
   \gdef\@preamble{\the\tab@preamble}%
   \let\tab@bgroup\begingroup%
@@ -2994,7 +2973,7 @@
   \extrarowheight\z@%
   \col@sep\smarraycolsep%
   \let\tab@extrasep\smarrayextrasep%
-  \def\tab@bmaths{$\color@begingroup\scriptstyle}%
+  \def\tab@bmaths{\color@begingroup$\scriptstyle}%
   \def\tab@btext{\begingroup\scriptsize}%
   \setbox\z@\hbox{\scriptsize\strut}%
   \dimen@\ht\z@\dimen@ii\dp\z@\tab@setstrut%
@@ -3808,7 +3787,7 @@
 %
 % \begin{macro}{\tab@dohline}
 %
-% This is where hlines actually get drawn.  
+% This is where hlines actually get drawn.
 % Drawing lines is more awkward than it used to be, particularly in unboxed
 % tables.  It used to be a case simply of saying |\noalign{\hrule}|.
 % However, since unboxed tables are actually much wider than they look, this
@@ -4014,18 +3993,18 @@
 %       Computer Programming} use the little `stub lines' to show where
 %       data items cross byte boundaries:
 %
-%	^^A This actually looks terrifyingly similar to the original.
-%	^^A The leading @{} is there to stop the table looking off-centre,
-%	^^A because there's no left hand rule telling you where the table
-%	^^A starts, like there is on the right, just the \tabcolsep glue.
+%       ^^A This actually looks terrifyingly similar to the original.
+%       ^^A The leading @{} is there to stop the table looking off-centre,
+%       ^^A because there's no left hand rule telling you where the table
+%       ^^A starts, like there is on the right, just the \tabcolsep glue.
 %
-%	\begingroup
-%	\newcommand{\wide}[2]{\multicolumn{#1}{c|}{\ttfamily #2}}
-%	\begin{tabular}[C]{@{} r @{\qquad} | Mc | *{5}{c|}} \hlx{c{2-7} v}
-%          empty & - & 1 & 0 & 0 & 0 & 0		\\ \hlx{v c{2-7} v}
-%	occupied & + & \wide{2}{LINK} & \wide{3}{KEY}	\\ \hlx{v c{2-7}}
-%	\end{tabular}
-%	\endgroup
+%       \begingroup
+%       \newcommand{\wide}[2]{\multicolumn{#1}{c|}{\ttfamily #2}}
+%       \begin{tabular}[C]{@{} r @{\qquad} | Mc | *{5}{c|}} \hlx{c{2-7} v}
+%          empty & - & 1 & 0 & 0 & 0 & 0                \\ \hlx{v c{2-7} v}
+%       occupied & + & \wide{2}{LINK} & \wide{3}{KEY}   \\ \hlx{v c{2-7}}
+%       \end{tabular}
+%       \endgroup
 %
 % \end{itemize}
 %
@@ -4906,7 +4885,7 @@
   \if@fleqn%
     \eqaopenskip\mathindent%
     \splitleft\mathindent\relax%
-    \splitright\mathindent\@minus\mathindent\relax%  
+    \splitright\mathindent\@minus\mathindent\relax%
   \else%
     \eqaopenskip\@centering%
     \splitleft2.5em\@minus2.5em%
@@ -5168,7 +5147,7 @@
 % \end{environment}
 % \end{environment}
 %
-% Now we can define the column types. 
+% Now we can define the column types.
 %
 %    \begin{macrocode}
 \colpush{eqnarray}
@@ -5253,13 +5232,13 @@
 % The macro |\eqa@eqpos| will put its argument in the right place.
 %
 %    \begin{macrocode}
-\if@leqno
-  \def\eqa@eqpos#1{%
+\def\eqa@eqpos#1{%
+  \if@leqno%
     \hb@xt@.01\p@{}\rlap{\normalfont\normalcolor\hskip-\displaywidth#1}%
-  }
-\else
-  \def\eqa@eqpos#1{\normalfont\normalcolor#1}
-\fi
+  \else%
+    \normalfont\normalcolor#1%
+  \fi%
+}
 %    \end{macrocode}
 %
 % \end{macro}
@@ -5602,9 +5581,13 @@
 % we need to remove them by hand at the extremities of the environment.
 %
 %    \begin{macrocode}
-\def\subsplit{%
+\def\subsplit{\@ifnextchar[\subsplit@i{\subsplit@i[c]}}
+\def\subsplit@i[#1]{%
+  \let\@tempa\vcenter%
+  \if#1t\let\@tempa\vtop\fi%
+  \if#1b\let\@tempa\vbox\fi%
   \let\\\seq@cr%
-  \vcenter\bgroup%
+  \@tempa\bgroup%
   \seq@dosplit{\hfil\qquad$##$\qquad\hfil}{\hfilneg\hskip-2em}%
 }
 %    \end{macrocode}