X-Git-Url: https://git.distorted.org.uk/~mdw/mdwtools/blobdiff_plain/eafdddad07cf0a91ba07cbd9309a0a46e3bd00ac..7f306c19f635aba42572c1223d575805b1367ec5:/mdwtab.dtx

diff --git a/mdwtab.dtx b/mdwtab.dtx
index b972848..d011bdd 100644
--- a/mdwtab.dtx
+++ b/mdwtab.dtx
@@ -44,7 +44,7 @@
 %<+color>                [2003/08/24 1.10 Fix for people who can't spell]
 % \end{meta-comment}
 %
-% \CheckSum{3402}
+% \CheckSum{3424}
 %% \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
@@ -367,10 +367,12 @@
 %                 actual column entry.                  \\ \hlx{.}
 % "<{"<text>"}" & Inserts \<text> just after the
 %                 actual column entry.                  \\ \hlx{.}
-% "?<{"<text>"}" & Inserts \<text> before the column
+% "?>{"<text>"}" & Inserts \<text> before the column
 %                 entry \emph{and} the rules list.*     \\ \hlx{.}
-% "?>{"<text>"}" & Inserts \<text> after the column
-%                 entry \emph{and} the rules list.*     \\ \hlx{vhv.}
+% "?<{"<text>"}" & Inserts \<text> after the column
+%                 entry \emph{and} the rules list.*     \\ \hlx{.}
+% "'{"<text>"}" & Inserts \<text> into the rules list
+%                 only.*                                \\ \hlx{vhv.}
 % "*{"<count>"}{"<chars>"}" & Inserts \<count>
 %                 copies of the \<chars> into the
 %                 preamble.                             \\ \hlx{vhs}
@@ -713,8 +715,7 @@
 % |\arrayrulewidth|.  However, there's an optional argument which can contain
 % one of:
 %
-% \begin{description}
-% \renewcommand\makelabel[1]{\kern\labelsep\ttfamily#1}
+% \begin{description} \setdescriptionlabel{\ttfamily#1}
 % \item[thin] Use |\arrayrulewidth| as the line width.  This is the default.
 % \item[thick] Use |\arraythickrulewidth| as the line width.  This is the
 %   same as giving a |*| after the command.
@@ -1202,9 +1203,9 @@
 % \end{demo}
 %
 %
-% \subsection{The \env{mathenv} package alignment environments}
+% \subsection{The \package{mathenv} package alignment environments}
 %
-% The \env{mathenv} package provides several environments for aligning
+% The \package{mathenv} package provides several environments for aligning
 % equations in various ways.  They're mainly provided as a demonstration of
 % the table handling macros in \package{mdwtab}, so don't expect great
 % things.  If you want truly beautiful mathematics, use
@@ -2718,6 +2719,9 @@
   {#2}%
   \tab@append\tab@shortline{#2}%
 }
+\coldef '#1{%
+  \tab@append\tab@shortline{#1}%
+}
 %    \end{macrocode}
 %
 % The strange column type.
@@ -2726,16 +2730,30 @@
 \coldef ##1#2{\tabcoltype{#1}{#2}}
 %    \end{macrocode}
 %
-% And \lit{*}, which repeats a preamble spec.  This is really easy, and not
-% at all like the original one.
+% And \lit{*}, which repeats a preamble spec.  The tricky part is ensuring
+% that nested \lit{*} specs work correctly: we must save the loop counter, in
+% |\count 0|, obviously, but \emph{also} the |\iterate| macro built which
+% |\loop| modifies internally.  Usually you'd use grouping to fix this, but
+% if we introduce a group level then we won't update the preamble registers
+% correctly.  Instead, queue up tokens to restore the values in \TeX's input
+% list.
 %
 %    \begin{macrocode}
 \coldef *#1#2{%
-  \count@#1%
-  \loop\ifnum\count@>0\relax%
-    \tab@doreadpream{#2}%
-    \advance\count@\m@ne%
-  \repeat%
+  \toks\tw@\expandafter{\iterate}%
+  \toks@{%
+    \count@#1%
+    \loop\ifnum\count@>0\relax%
+      \tab@doreadpream{#2}%
+      \advance\count@\m@ne%
+    \repeat%
+  }%
+  \edef\@tempa{%
+    \the\toks@%
+    \def\noexpand\iterate{\the\toks\tw@}%
+    \count@\the\count@%
+  }%
+  \@tempa%
 }
 %    \end{macrocode}
 %
@@ -2973,7 +2991,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%
@@ -4792,7 +4810,7 @@
 %
 % \begin{macro}{\ifmod}
 %
-% \syntax{"\\ifmod{"$x$"}{"$m$"}{"y"}{"<yes>"}{"<no>"}"} -- if $x \bmod m =
+% \syntax{"\\ifmod{"$x$"}{"$m$"}{"$y$"}{"<yes>"}{"<no>"}"} -- if $x \bmod m =
 % y$ then do \<yes>; otherwise do \<no>.
 %
 %    \begin{macrocode}
