summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/ruled-tables
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/plain/contrib/ruled-tables
Initial commit
Diffstat (limited to 'macros/plain/contrib/ruled-tables')
l---------macros/plain/contrib/ruled-tables/README1
-rw-r--r--macros/plain/contrib/ruled-tables/readme.ruled-tables10
-rw-r--r--macros/plain/contrib/ruled-tables/ruled.tex374
-rw-r--r--macros/plain/contrib/ruled-tables/ruleddoc.tex470
4 files changed, 855 insertions, 0 deletions
diff --git a/macros/plain/contrib/ruled-tables/README b/macros/plain/contrib/ruled-tables/README
new file mode 120000
index 0000000000..f28888e82f
--- /dev/null
+++ b/macros/plain/contrib/ruled-tables/README
@@ -0,0 +1 @@
+readme.ruled-tables \ No newline at end of file
diff --git a/macros/plain/contrib/ruled-tables/readme.ruled-tables b/macros/plain/contrib/ruled-tables/readme.ruled-tables
new file mode 100644
index 0000000000..375ba778d9
--- /dev/null
+++ b/macros/plain/contrib/ruled-tables/readme.ruled-tables
@@ -0,0 +1,10 @@
+% RULED TABLES.
+%
+% The file ruled.tex contains a set of macros which can be used to typeset
+% tables with vertical and horizontal rules. The syntax is the same
+% as for Ray Cowan's macros TABLES.TEX, as described in TABELDOC.TEX,
+% and I have used some of Cowan's tricks, but most of the macros
+% are complete re-writes. To use these macros in place of Cowan's
+% simply copy them to a file called TABLES.TEX or use a link.
+%
+% Eric Myers, University of Texas at Austin, 27 February, 1990
diff --git a/macros/plain/contrib/ruled-tables/ruled.tex b/macros/plain/contrib/ruled-tables/ruled.tex
new file mode 100644
index 0000000000..578c187bd6
--- /dev/null
+++ b/macros/plain/contrib/ruled-tables/ruled.tex
@@ -0,0 +1,374 @@
+% file: ruled.tex TeXsis version 2.14
+% :: $Header: /usr2/myers/texsis/RCS/ruled.tex,v 1.5 90/06/21 13:47:44 myers Stab $
+%======================================================================*
+% RULED TABLES. E. Myers and F.E. Paige
+%
+% The following macros will typeset tables with vertical and
+% horizontal rules. The syntax is similar to Ray Cowan's TABLES.TEX,
+% but the macros have been completely rewritten. Vertical and horizontal
+% rules are drawn by macros using vertical spacing controlled by struts.
+% Usage:
+% \ruledtable
+% <item> <tab> ... <item> <cr>
+% ...
+% <item> <tab> ... <item> \endruledtable
+% where <item> is an element of the table (every row must have exactly
+% the same number of items, although some may be blank), <tab> is any
+% one of
+% & for no vertical rule
+% | [or \vb] for vertical rule
+% \| [or \Vb] for thick vertical rule
+% \dbl for double vertical rule
+% and <cr> is any one of
+% \nr for no horizontal rule
+% \cr for horizontal rule
+% \CR [or \crthick] for thick horizontal rule
+% The last <cr> must be omitted in favour of the \endruledtable
+%
+% For horizontal rules across only some columns use
+% ... \nr
+% \crule | \cskip & \Crule ... \crpart
+% where \crpart is a special \cr for the partial rule line and
+% \cskip no rule for column
+% \crule horizontal rule for column
+% \Crule thick horizontal rule for column
+% The number of columns must be identical to the other rows.
+%
+% To change the appearance of the table, modify \TableItem.
+% Several modifications are built in:
+% \LeftJustifyTables left justify each column
+% \RightJustifyTables right justify each item
+% \NoJustifyTables center each item (default)
+% \TightTables use \ horizontal spacing
+% \LooseTables use \quad horizontal spacing (default)
+%
+% Use \bigitem to expand the vertical strut for high or deep items.
+%
+% These macros have been reorganized and substantially revised from
+% version 2.13. The following functional changes have been made:
+% (1) The @ signs have been removed from the names of the macros
+% used to save the Plain \cr, \span, and & so that they can be used to
+% modify the preamble. See above.
+% (2) Macros for partial horizontal rules have been added.
+%======================================================================*
+% Counters and such:
+\catcode`@=11 % @ is a letter here
+\catcode`\|=12 % make sure | is not active
+\catcode`\&=4 % and that & is alignment tab
+
+\newcount\ncols \ncols=\z@ % number of columns in table
+\newcount\nrows \nrows=\z@ % number of rows in table
+\newcount\curcol \curcol=\z@ % current column counter
+\let\currow=\nrows % current row counter
+
+\newdimen\thinsize \thinsize=0.6pt % thin rule width
+\newdimen\thicksize \thicksize=1.5pt % thick rule width
+
+\newif\iftableinfo \tableinfotrue % report rows and columns? Yes
+\newif\ifcentertables \centertablestrue % center tables? Yes
+\def\centeredtables{\centertablestrue}%
+\def\noncenteredtables{\centertablesfalse}%
+\def\nocenteredtables{\centertablesfalse}% % synonym !
+
+\let\plaincr=\cr % save real \cr
+\let\plainspan=\span % save real \span
+\let\plaintab=& % save real alignment tab &
+\def\ampersand{\char`\&}% % to print `&' in text
+\let\lparen=( % save left paren
+\let\NX=\noexpand % shorthand for \noexpand is \NX
+
+%---------------------------------------*
+% Main macros:
+% \ruledtable <table stuff> \endruledtable turns on the ruled
+% table definitions and makes the table with \halign. It handles all
+% the control stuff; the real work is done by \@RuledTable.
+
+\def\ruledtable{\relax % make ruled table
+ \@BeginRuledTable % initialize table
+ \@RuledTable}% % now process table body
+
+% \@BeginRuledTable does all the work of setting things up before
+% we read in the body of the table
+
+\def\@BeginRuledTable{% % initialize table
+ \ncols=0\nrows=0 % reset row and column count
+ \begingroup % keep the following local
+ \offinterlineskip % so vrules touch
+ \def~{\phantom{0}}% % ~ is phantom digit
+ \def\span{\plainspan\omit\relax\colcount\plainspan}% \span USER columns
+ \let\cr=\crrule % \cr gives a \tablerule
+ \let\CR=\crthick % \CR gives a \thickrule
+ \let\nr=\crnorule % \nr give no rule
+ \let\|=\Vb % thick vrule between columns
+%
+% support old \tablestrut in place of \tstrut if it exists
+%
+ \ifx\tablestrut\undefined\relax % if not defined, no problem
+ \else\let\tstrut=\tablestrut\fi % use \tablestrut
+%
+ \catcode`\|=13 \catcode`\&=13\relax % make | and & active
+ \TableActive % | and & get active \def`s
+ \curcol=1 % reset column count
+%
+% define \Halign to do an \halign with or without a width
+%
+ \ifdim\tablewidth>-\maxdimen\relax %
+ \edef\@Halign{\NX\halign to \NX\tablewidth\NX\bgroup\TablePreamble}%
+ \tabskip=0pt plus 1fil % let things stretch
+ \else %
+ \edef\@Halign{\NX\halign\NX\bgroup\TablePreamble}%
+ \tabskip=0pt % no stretch between columns
+ \fi %
+%
+% center text if needed
+%
+ \ifcentertables % should table be centered?
+ \ifhmode\vskip 0pt\fi % yes: force vertical mode
+ \line\bgroup\hss % center across page
+ \else\hbox\bgroup % else: just put in \hbox
+ \fi}% % end of \@BeginRuledTable
+
+
+% \@RuledTable builds the table with \@Halign and getting the
+% table body text as its argument.
+
+\long\def\@RuledTable#1\endruledtable{% % ruled table alignment
+ \vrule width\thicksize % thick rule on side
+ \vbox{\@Halign % then do \halign
+ \thickrule % thick rule on top
+ #1\relax % body of table
+ \tstrut % vertical strut for last line
+ \plaincr\thickrule % \cr, thick rule on bottom
+ \egroup}% % end of \halign and \vbox
+ \vrule width\thicksize % thick rule on side, end \hbox
+ \ifcentertables\hss\fi\egroup % finish table centering
+ \endgroup % end group from \ruledtable
+ \global\tablewidth=-\maxdimen % and reset width
+ \iftableinfo % report rows and columns
+ \immediate\write16{[Nrows=\the\nrows, Ncols=\the\ncols]}%
+ \fi}% % end of \@RuledTable
+
+%---------------------------------------*
+% Preamble and item macros:
+% This is the preamble for the \halign in \ruledtable.
+% To change how each item is processed change \TableItem.
+% To make a more complicated table you can change the \TablePreamble,
+% but if yo do so use the following substitutions in a standard \halign
+% preamble:
+% for & use \plaintab
+% for \cr use \plaincr
+% for # use ##
+% for ## use ####
+% and put \linecount in the first column so that line counting
+% works properly.
+
+\def\TablePreamble{% % \ruledtable preamble
+ \linecount % count this line
+ \TableItem{####}% % the first item
+ \plaintab\plaintab % && means repeat this
+ \TableItem{####}% % the subsequent items
+ \plaincr}% % end of preamble
+
+% \TableItem contains glue or spacing around the item
+
+\def\@TableItem#1{% % centers item in ruled table
+ \hfil\tablespace % left glue
+ #1\relax % item
+ \tablespace\hfil % right glue
+ }%
+
+\def\@tableright#1{% % right justifies item in ruled table
+ \hfil\tablespace\relax % left glue
+ #1\relax % item
+ \tablespace\relax}% % right glue
+
+\def\@tableleft#1{% % left justifies item in ruled table
+ \tablespace\relax % left glue
+ #1\relax % item
+ \tablespace\hfil}% % right glue
+
+\let\TableItem=\@TableItem % default is centered
+
+\def\RightJustifyTables{\let\TableItem=\@tableright}% % to right justify
+\def\LeftJustifyTables{\let\TableItem=\@tableleft}% % to left justify
+\def\NoJustifyTables{\let\TableItem=\@TableItem}% % to center
+
+\def\LooseTables{\let\tablespace=\quad}% % table spacing is \quad
+\def\TightTables{\let\tablespace=\space}% % table spacing is space
+\LooseTables % default is \quad
+
+%---------------------------------------*
+% Table Height and Width:
+%
+% Normally tables are set to their natural width. If \tablewidth
+% has been set then we set the table to that width instead,
+% but only for the next table. Then \tablewidth is turned off
+
+
+\newdimen\tablewidth \tablewidth=-\maxdimen % start ``turned off''
+
+% \setRuledStrut sets up the vertical strut \tstrut with
+% the appropriate dimensions to hold up one line of a ruled table.
+
+
+\def\setRuledStrut{% sets interlines spacing for ruled tables
+ \dimen@=\baselineskip % \dimen@ = extra space
+ \advance\dimen@ by-\normalbaselineskip % between lines
+ \ifdim\dimen@<.5ex \dimen@=.5ex\fi % minimum space
+ \setbox0=\hbox{\lparen}% % get character size
+ \dimen1=\dimen@ \advance\dimen1 by \ht0 % space above line
+ \dimen2=\dimen@ \advance\dimen2 by \dp0 % space below line
+ \def\tstrut{\vrule height\dimen1 depth\dimen2 width\z@}%
+ }%
+
+\def\tstrut{\vrule height 3.1ex depth 1.2ex width 0pt}% default
+
+
+% \tstrut does not produce the correct spacing if the entry in
+% the table is too high. The following constructs a strut higher than its
+% argument and then prints the argument. The minimum space value should
+% be the same as in \setRuledStrut.
+
+
+\def\bigitem#1{% % larger table entry
+ \setbox0=\hbox{#1}% % put arg. in box and
+ \dimen1 =\ht0 \dimen2 =\dp0 % get its size
+ \dimen@ =\baselines@ve % \dimen@ = extra space
+ \advance\dimen@ by-\normalbaselineskip % between lines
+ \ifdim\dimen@<.25ex \dimen@=.25ex\fi % minimum space
+ \advance\dimen1 by \dimen@ % space above line
+ \advance\dimen2 by \dimen@ % space below line
+ \vrule height\dimen1 depth\dimen2 width\z@ % make strut to size
+ \copy0}% % print argument
+
+
+% \vctr{stuff} centers the stuff vertically, so that it can
+% appear between two ROWS.
+
+\def\vctr#1{\hfil\vbox to 0pt{\vss\hbox{#1}\vss}\hfil}%
+
+%---------------------------------------*
+% Vertical rules:
+% \tab, \vb and \Vb are used in a table to separate columns with no
+% rule, a thin rule, or a thick rule, respectively. \nextcolumn{<rule>} skips
+% to the next column and puts the <rule> between columns. Use this to build
+% your own separators.
+
+\def\nextcolumn#1{% % move to next col.
+ \plaintab\omit#1\relax\colcount % tab, insert #1, count
+ \plaintab}% % tab to next user col.
+
+\def\tab{% % no rule between columns
+ \nextcolumn{\relax}}% % count column
+
+\let\novb=\tab % synonym for \tab
+
+\def\vb{% % thin rule between columns
+ \nextcolumn{\vrule width\thinsize}}% % count and rule
+
+\def\Vb{% % THICK rule between columns
+ \nextcolumn{\vrule width\thicksize}}% % count and thick rule
+
+\def\dbl{% % double rule between columns
+ \nextcolumn{\vrule width\thinsize % count and rule
+ \hskip\thinsize\vrule width\thinsize}}% % and skip and rule
+
+% \TableActive makes | the same as \vb and & the same as \tab so
+% these single characters can be used between columns. Here we have to
+% make & and | active so we get the active version of the characters,
+% hence the temporary change of \catcode.
+
+{\catcode`\|=13 \let|0
+ \catcode`\&=13 \let&0
+ \gdef\TableActive{\let|=\vb \let&=\tab}%
+}% end \catcode`s
+
+%---------------------------------------*
+% Horizontal rules:
+% These replacements for \cr put a wide \vrule at the end of the
+% line and maybe put a rule under the line, then begin the next line
+% with the wide \vrule from the preamble.
+
+
+\def\crrule{\relax % \cr plus rule
+ \tstrut % strut for spacing
+ \plaincr\tablerule % \cr, regular rule below line
+ }%
+
+\def\crthick{\relax % \cr plus thick rule
+ \tstrut % strut for vertical spacing
+ \plaincr\thickrule % \cr, rule, begin next line
+ }%
+
+\def\crnorule{\relax % \cr plus no rule
+ \tstrut % strut for spacing
+ \plaincr % \cr, norule, begin next line
+ }%
+
+\def\crpart{\plaincr}% % for partial rules, no strut
+
+
+% These rules go across the table.
+
+\def\tablerule{\noalign{\hrule height\thinsize depth 0pt}}%
+\def\thickrule{\noalign{\hrule height\thicksize depth 0pt}}%
+
+
+% Rules for individual columns. You must use \cskip in columns
+% with no rules to \omit the \TablePreamble.
+
+\def\cskip{\omit\relax}%
+\def\crule{\omit\leaders\hrule height\thinsize depth0pt\hfill}%
+\def\Crule{\omit\leaders\hrule height\thicksize depth0pt\hfill}%
+
+%---------------------------------------*
+% Counting macros:
+% These macros count rows and columns of the table. After the
+% first line has been processed \the\ncols is the total number of
+% columns in the table, which may be useful. During processing,
+% \the\curcol is the number of the current column, while \the\currow is
+% the number of the current row.
+
+
+\def\linecount{\relax\global\ncols=\curcol % save column count in \ncols
+ \global\curcol=1 % and reset counter
+ \global\advance\nrows by 1\relax}% % and advance row counter
+
+\def\colcount{\relax %
+ \global\advance\curcol by 1\relax}% % advance column counter
+
+%---------------------------------------*
+% TEXT TABLES.
+% To put text in a table use \para{<text>}, with \parasize set
+% to the desired width of the text.
+
+
+\newdimen\parasize \parasize=4in % paragraph size in tables
+
+\long\def\para#1{%
+ \vtop{\hsize=\parasize %
+ \baselineskip=14pt \lineskip=1pt %
+ \lineskiplimit=1pt %
+ \noindent #1\relax %
+ \vrule width 0pt depth 6pt}% % hold depth of box
+}%
+
+%---------------------------------------*
+% TABLES.TEX
+% For compatability with Cowan's TABLES.TEX we also allow the
+% syntax \begintable ... \endtable, which do the same thing.
+%
+
+\def\begintable{\relax % make ruled table
+ \@BeginRuledTable % initialize table
+ \@begintable}% % now process table body
+
+\long\def\@begintable#1\endtable{% % ruled table alignment
+ \@RuledTable#1\endruledtable}% % same as \ruledtable
+
+%---------------------------------------*
+% Turn off @ as letter before we exit
+
+\catcode`@=12 % @ is not a letter
+
+%>>> EOF TXSruled.tex <<<
diff --git a/macros/plain/contrib/ruled-tables/ruleddoc.tex b/macros/plain/contrib/ruled-tables/ruleddoc.tex
new file mode 100644
index 0000000000..71b1d4ffa6
--- /dev/null
+++ b/macros/plain/contrib/ruled-tables/ruleddoc.tex
@@ -0,0 +1,470 @@
+% ruleddoc.tex TeXsis version 2.14
+% :: $Header$
+%======================================================================*
+% This is the section of the manual on ruled table macros.
+% I'm still working on describing all the features. Read the code
+% in ruled.tex to learn everything. -EAM
+
+\book % ``book'' document style
+\input TXSdocM.doc % special macros for this manual
+
+\input ruled
+\ATunlock % so we can use @ things
+
+\singlespaced % single spaced
+\parskip=\baselineskip
+\TeXquoteon % | is a TeX quote (printed in \tt)
+\singlelinetrue % for \description
+\def\VT{\char'174}
+
+%======================================================================*
+\subsection{Ruled Tables \label{sect.ruled}}
+
+ While |\halign| in Plain \TeX\ is convenient for making simple
+tables, it is still difficult to make tables with horizontal and
+vertical rules. Indeed, typesetting ruled tables in \TeX\ has often
+been likened to programming a computer in assembler language. Even
+\TeXbook\ acknowledges that ``people who know how to make ruled tables
+are generally known as \TeX\ Masters.''\reference{Masters} Knuth, {\it
+op.\ cit.}, page 245
+\endreference\relax
+\TeXsis\ now includes a set of macros that take a great deal
+of the difficulty out of making ruled tables, so that anybody can be a
+\TeX\ Master.
+
+ The basic idea behind making a ruled table is similar to
+|\halign|, and the syntax is the same as the Princeton table
+macros known as |TABLES.TEX| by Ray Cowan,\reference{Cowan} Ray
+F.~Cowan, {\sl Making Tables with Macros} (unpublished)
+\endreference
+although the \TeXsis\ macros are quite different internally and
+run about 5 times faster. You begin the table material with |\ruledtable|
+and end it with |\endruledtable|. The table material is a list
+of items to appear in the rows and columns of the tables. Just
+as with |\halign| you can separate items in different columns
+with |&| and end a row with |\cr|. The |&| alignment character
+separates columns without putting a vertical rule between the
+columns, while |\cr| ends a line and puts a thin horizontal rule
+under it. To get a vertical rule between columns replace the |&|
+with a `{\tt\VT}' (the vertical line), and to end a line without
+a horizontal rule under it replace the |\cr| with |\crnorule|.
+One important thing to remember is to end the last line in the
+table with |\endruledtable| instead of |\cr|!
+
+ As an example here is a simple ruled table:
+{\singlespaced
+\bigskip
+\ruledtable
+Year | World Population \cr
+8000 B.C. | ~~~5000000 \crnorule
+~~50 B.C. | ~200000000 \crnorule
+1650 A.D. | ~500000000 \crnorule
+1850 A.D. | 1000000000 \crnorule
+1945 A.D. | 2300000000 \crnorule
+1980 A.D. | 4400000000
+\endruledtable
+\smallskip}
+\noindent And here are the instructions that created it:
+\TeXexample
+\ruledtable
+Year |VT World Population \cr
+8000 B.C. |VT ~~~5000000 \crnorule
+~~50 B.C. |VT ~200000000 \crnorule
+1650 A.D. |VT ~500000000 \crnorule
+1850 A.D. |VT 1000000000 \crnorule
+1945 A.D. |VT 2300000000 \crnorule
+1980 A.D. |VT 4400000000
+\endruledtable
+|endTeXexample
+This example also appears in \TeXbook, where it is typeset using
+|\halign|. Compare how the two are constructed
+and see which way you think is easier.
+
+ By default each item in the table is centered in its column.
+Inside a table the tie character ``|~|'' takes up the
+space of exactly one digit (it is the same as saying |\phantom{0}|),
+and this has been used to line up the digits of the entries in
+both columns. It is also possible to change the definition of
+the |\TableItem| macro so that each entry in each column is left
+or right justified. This is described a little bit later.
+
+ Something to note about this example table is that the outer
+rules are thicker than the others. You can also get a thick
+vertical rule between columns by using ``{\tt\bs\VT}'' in place of
+``{\tt\VT}'', and you can get a thick horizontal rule below a row by
+replacing the |\cr| with |\crthick|. The widths of thick and
+thin rules are controlled by the dimensions |\thicksize| and
+|\thinsize|. If you don't want thick rules at all simply say
+|\thicksize=\thinsize|, which makes the thick rules as thin
+as the thin rules.
+
+ Some synonyms: |\CR| is the same as |\crthick|, |\nr| is the
+same as |\crnorule|, and |\crrule| is the same as |\cr| (actually
+it's the other way around!). |\tab| is the same as |&| --- it
+separates columns without a vertical rule. |\vb| is the same as
+{\tt\VT}, it separates columns with a thin vertical bar, while
+|\Vb| is the same as {\tt\bs\VT} and separates the columns with a
+thick vertical bar. You can also use |\dbl| to separate columns
+with a double vertical rule.
+
+ As in Plain \TeX\ you can use |\span| in place of |&| (or the
+other column separators) to join two columns together into one,
+and you can use |\omit| as the very first token in a column to
+tell it to omit the fancy column layout (the centering or other
+spacing). You can also use |\multispan| to |\span| and |\omit|
+several columns, just as in an |\halign|. The only difference is
+that the number of columns you tell it to |\multispan| is the
+number of columns of the table it spans --- with an |\halign| you
+have to count the columns {\it and} any vertical rules.
+
+\table{table-example-II}
+\singlespaced
+\ruledtable
+\multispan3\hfil AT\&T Common Stock \hfil\CR
+ Year \dbl Price | Dividend \cr
+ 1971 \dbl 41-54 | \$2.60 \cr
+ ~~~2 \dbl 41-54 | \$2.70 \cr
+ ~~~3 \dbl 46-55 | \$2.87 \cr
+ ~~~4 \dbl 40-53 | \$3.24 \cr
+ ~~~5 \dbl 45-52 | \$3.40 \cr
+ ~~~6 \dbl 51-59 | ~~.95
+\endruledtable
+\caption{Another example of a ruled table.}
+\endtable
+
+ \Tbl{table-example-II} is another sample table, again taken
+{from} \TeXbook. Something important to notice is that the last
+ruled table example didn't have a table number or a caption,
+while this one does. That's because the last example was created
+using just |\ruledtable|, while this example is inside of
+|\table|. The point is that |\table| and |\ruledtable| do
+separate things and can be used either separately or together:
+|\table| creates the space for the table and gives it a caption
+and a number, while |\ruledtable| actually constructs the body of
+the ruled table. The instructions that created \Tbl{table-example-II}
+are:
+\TeXexample
+\table{table-example-II}
+\singlespaced
+\ruledtable
+\multispan3\hfil AT\&T Common Stock \hfil\CR
+Year \dbl Price | Dividend \cr
+1971 \dbl 41-54 | \$2.60 \cr
+~~~2 \dbl 41-54 | \$2.70 \cr
+~~~3 \dbl 46-55 | \$2.87 \cr
+~~~4 \dbl 40-53 | \$3.24 \cr
+~~~5 \dbl 45-52 | \$3.40 \cr
+~~~6 \dbl 51-59 | ~~.95
+\endruledtable
+\caption{Another example of a ruled table.}
+\endtable
+|endTeXexample
+\medskip
+
+ Ruled tables are normally centered on the page, but you can turn
+off the centering with |\noncenteredtables|. Then the table becomes just
+another piece to add to a horizontal list. One thing this lets you do is
+have two tables side by side on the page, like so:
+\noncenteredtables
+\medskip
+\line{
+\ruledtable
+Item ABC | Item DEF \cr
+Item GHI | Item JKL \endruledtable
+\hfil
+\ruledtable
+Data 111 | Data 222 \cr
+Data 333 | Data 444 \cr
+Data 555 | Data 666 \endruledtable}
+\smallskip
+\noindent This pair of tables was produced by saying:
+\TeXexample
+\noncenteredtables
+\medskip
+\line{
+\ruledtable
+Item ABC | Item DEF \cr
+Item GHI | Item JKL \endruledtable
+\hfil
+\ruledtable
+Data 111 | Data 222 \cr
+Data 333 | Data 444 \cr
+Data 555 | Data 666 \endruledtable}
+\smallskip
+|endTeXexample
+\noindent Saying |\centeredtables| turns table centering back on.
+Tables are then centered across the page, and a table is then
+added to a {\it vertical} list.
+\bigskip
+\goodbreak
+
+ Usually |\ruledtable| makes tables as wide as their
+natural width, but it is possible to make them wider by
+setting the dimension |\tablewidth| to the width desired. We
+can make the same table in
+\Tbl{table-example-II} but with the width set to 10cm:
+%
+\bigskip
+\noncenteredtables
+\tablewidth=10cm
+\line{\hfil\vbox{\singlespaced
+\ruledtable
+\multispan3\hfil AT\&T Common Stock \hfil\CR
+Year \dbl Price | Dividend \cr
+1971 \dbl 41-54 | \$2.60 \cr
+~~~2 \dbl 41-54 | \$2.70 \cr
+~~~3 \dbl 46-55 | \$2.87 \cr
+~~~4 \dbl 40-53 | \$3.24 \cr
+~~~5 \dbl 45-52 | \$3.40 \cr
+~~~6 \dbl 51-59 | ~~.95\rlap*
+\endruledtable
+\hbox{* (first quarter only)}
+\vss}\hfil}
+\smallskip
+\noindent
+The careful reader will notice that the version of
+\Tbl{table-example-II} in \TeXbook\ had a footnote to the last
+entry, and we have added that here. To do so we had to put the footnote
+in an |\hbox| and stack it under the table, so we had to turn off
+table centering. The table is therefore a bit more complicated
+to make, but not much:
+\TeXexample
+\noncenteredtables
+\tablewidth=10cm
+\line{\hfil\vbox{\singlespaced
+\ruledtable
+\multispan3\hfil AT\&T Common Stock \hfil\CR
+Year \dbl Price | Dividend \cr
+1971 \dbl 41-54 | \$2.60 \cr
+~~~2 \dbl 41-54 | \$2.70 \cr
+~~~3 \dbl 46-55 | \$2.87 \cr
+~~~4 \dbl 40-53 | \$3.24 \cr
+~~~5 \dbl 45-52 | \$3.40 \cr
+~~~6 \dbl 51-59 | ~~.95\rlap*
+\endruledtable
+\hbox{* (first quarter only)}
+\vss}\hfil}
+|endTeXexample
+\centeredtables % turn back on!
+
+ Important note: |\tablewidth| is turned ``off'' after the
+table is made, so the next table will have its natural width
+unless you explicitly set |\tablewidth| again!
+\bigskip\goodbreak
+
+The careful reader may also have noticed that in making the
+example in \Tbl{table-example-II} we said |\singlespaced|.
+That's because the spacing of the rows of a table can be
+controlled just like the spacing of the of the text with
+|\singlespaced|, |\doublespaced|, etc. The space between the
+rows of a table is set by a strut called |\tstrut|, which
+holds the rows apart. You can change the spacing between rows by
+changing the definition of this strut. One of the things
+|\singlespaced| does is define the |\tstrut| to be 0.4ex
+higher and deeper than a parenthesis:
+\TeXexample
+\def\tstrut{\vrule height 2.24ex depth 1.08ex width 0pt}
+|endTeXexample
+\noindent
+|\doublespaced| increases the height of the strut by one ``ex,''
+while |\triplesaced| increases it by yet another ``ex.'' You can
+re-define |\tstrut| to be whatever you want to suit your
+tastes. If you have something to put in a table which is larger
+than the strut then it will spill out into the rows above or
+below. To prevent this you could put the item in an |\hbox|, but
+this is not quite satisfactory, since there won't be any space
+above or below the item. Instead you can say
+|\bigitem{|\meta{stuff }|}| and ``stuff'' will be positioned
+correctly with a nice amount of space above and below.
+\medskip
+
+ You can also decide whether or not you want diagnostic messages
+printed when a table is created. |\tableinfotrue| causes a
+message to be printed on your terminal every time a ruled table
+is created. The message tells you how many rows and columns were
+in the table. This is useful information, because it can tell
+you immediately if you made a mistake in the table or left out a
+row or column. |\tableinfotrue| is the default, but you can turn
+off these messages by saying |\tableinfofalse|.
+\medskip
+
+ The tables we have demonstrated so far all contain numbers, but
+sometimes it is desirable to have an entry in a table which is a
+paragraph of text. For that purpose, you can use |\para{|\meta{text}|}|.
+The width of the paragraph is determined by the dimension |\parasize|,
+which defaults to 4 inches.
+\medskip
+
+\table{tablemac;a}
+\caption{Basic table macros for use with {\tt\bs ruledtable}.}
+\intablelist{Basic macros for {\tt\bs ruledtable}}
+\tablewidth=\hsize
+\LeftJustifyTables
+\ruledtable
+\sl Macro name\relax
+ | \sl Description \relax \crthick
+\tt\bs ruledtable\relax
+ | \para{Starts a ruled table.}\cr
+\tt\bs endruledtable\relax
+ | \para{Ends the ruled table.}\cr
+\tt\bs cr\relax
+ | \para{Ends the current row, and starts the next
+ one. The completed row will be separated from
+ the next with a thin horizontal rule.}\cr
+\vtop{\noindent\hsize=1.4in\baselineskip=15pt
+\tt\bs crthick \hfil\break \rm or \tt\bs CR\hfil }\relax
+ | \para{Similar to {\tt\bs cr}, but the rows will
+ be separated with a thick horizontal rule.}\cr
+\vtop{\noindent\hsize=1.4in\baselineskip=15pt
+\tt\bs crnorule \hfil\break \rm or \tt\bs nr\hfil }\relax
+ | \para{Similar to {\tt\bs cr}, but the rows will
+ not be separated by a rule.}\cr
+\vtop{\noindent\hsize=1.4in\baselineskip=15pt
+\tt\char124\quad \rm (vertical bar)\hfil\break
+or \tt\bs vb\hfil} \relax
+ | \para{Separates one column from the next, and
+ puts a vertical rule between them.} \cr
+\tt\&\ \rm or\tt\ \bs tab \relax
+ | \para{Same as {\tt\char124}, but does not put
+ in the vertical rule between the columns.}\cr
+\tt\bs\char124 \relax
+ | \para{Same as {\tt\char124}, but puts in a
+ thick vertical rule.}
+\endruledtable
+\line{\hfil {\sl Continued...}}
+\endtable
+
+\fulltable{tablemac;b}
+\caption{Additional macros for use with {\tt\bs ruledtable}.}
+\intablelist{Additional macros for {\tt\bs ruledtable}}
+\tablewidth=\hsize
+\LeftJustifyTables
+\line{{\sl Continued...}\hfil}
+\smallskip
+\ruledtable
+\sl Macro name\relax
+ | \sl Description \relax \crthick
+\tt\bs multispan\lb{\it n}\rb\relax
+ | \para{Makes the next entry span the next $n$
+ columns, where $n$ is an integer, $n>0$.
+ See other notes on {\tt\bs multispan} below.} \cr
+\tt\bs omit \relax
+ | \para{This \TeX\ primitive causes the normal
+ template for its entry to be omitted, allowing
+ the user to do something else with this entry.} \cr
+\tt\bs para\lb{\it text}\rb \relax
+ | \para{Formats {\it text} into a neat little
+ paragraph like this one. The width of the
+ paragraph produced is determined by the dimension
+ {\tt\bs parasize}. The default is 4 inches. } \cr
+\tt\bs parasize=\meta{dimen} \relax
+ | \para{Sets the width of paragraphs produced
+ with the {\tt\bs para} macro. } \cr
+\tt\bs TableItem\lb\#\rb\relax
+ | \para{Used in the standard template, this
+ macro centers its argument in the column. The
+ user can redefine it for special effects.} \cr
+\tt\bs bigitem\lb\#\rb\relax
+ | \para{Use this for something that would normally
+ not fit in one line of a table to make the spacing
+ between rows large enough for this item.} \cr
+\tt\bs vctr\lb\#\rb\relax
+ | \para{Centers the item {\it vertically} so that
+ it can appear between two rows.}\cr
+\tt\bs centeredtables\relax
+ | \para{Turns table centering on. Each table
+ will be centered left-to-right on the page.
+ This is the default.} \cr
+\tt\bs noncenteredtables\relax
+ | \para{Turns table centering off. Each table
+ is returned as an {\tt\bs hbox}, and it is up
+ to the user to place it as desired.} \cr
+\vtop{\noindent\hsize=1.4in\baselineskip=15pt
+\tt\bs tableinfotrue \hfil\break
+\tt\bs tableinfofalse\hfil}\relax
+ | \para{Turns on or off the diagnostic message telling
+ you how many rows and columns were found in the
+ table. }\cr
+\tt\bs thicksize=\meta{dimen} \relax
+ | \para{This dimension specifies the thickness
+ of the thick rules in the table. The default
+ size is 1.5 points.} \cr
+\tt\bs thinsize=\meta{dimen} \relax
+ | \para{This dimension specifies the thickness
+ of thin rules in the table. The default
+ size is 0.8 points.} \cr
+\tt\bs tablewidth=\meta{dimen} \relax
+ | \para{Specifies how wide to make the next
+ table. If not specified, the table is made to
+ its natural width. This value is reset
+ following the construction of each table.}
+\endruledtable
+\vskip 0pt plus 1fil\relax
+\endtable
+
+Tables \use{Tb.tablemac;a} and \use{Tb.tablemac;b} summarize the
+most important commands for making ruled tables.
+\medskip
+
+ Finally we can discuss how you can change how each column of
+a table is constructed. The macros which build the table take
+each entry and pass it to a macro called |\TableItem|. The
+default definition of |\TableItem| is:
+\TeXexample
+\def\TableItem#1{%
+ \hfil\tablespace % left glue
+ #1\relax % the item
+ \tablespace\hfil}% right glue
+|endTeXexample
+\noindent
+The |\hfil| glue on both sides of the argument causes the item to be
+centered in the column, while |\tablespace| (which defaults to |\quad|)
+insures that there will be at least some amount of space between the
+item and the vertical rules on each side. You can change the definition
+of |\TableItem| to suit your own purpose. The simplest modification is
+to omit the |\hfil| on the left or right so that each entry is right or
+left justified. This is so commonly used that saying
+|\RightJustifyTables| or |\LeftJustifyTables| makes the appropriate
+change for you. Saying |\NoJustifyTables| restores |\TableItem| to its
+original centering function.
+
+ Since |\TableItem| is used to create every column of the table you
+can't use it to modify a single column. To justify just one column you
+can simply put |\hfill| to the left or right of each item in the column,
+since
+|\hfill| is infinitely more stretchy
+than |\hfil|.
+With a little more work it is possible to design special or unusual
+tables by redefining the ``preamble'' of the table. This is possible
+because |\ruledtable| uses |\halign| with a preamble
+called |\TablePreamble|. The default
+definition of |\TablePreable| is:
+\TeXexample
+\def\TablePreamble{% % \ruledtable preamble
+ \linecount % count this line
+ \TableItem{####}% % the first item
+ \plaintab\plaintab % && means repeat this
+ \TableItem{####}% % the subsequent items
+ \plaincr}% % end of preamble
+|endTeXexample
+\noindent
+The syntax for |\TablePreamble| is like an
+|\halign| preamble in Plain \TeX\, but with |&| replaced by |\plaintab|,
+|\cr| replaced by |\plaincr|, and |#| replaced by |####|. If you have
+read this far and want to try changing |\TablePreable| then you should
+read the source code and the comments that go with it in the file
+|ruled.tex.|
+
+As a final note we point out that it is also possible for you to create
+your own column separators with the macro |\nextcolumn|. This macro
+takes
+a single argument which is used to separate one column of the table from
+another. Thus for example, the |\dbl| macro for creating a double
+vertical rule between columns is defined as:
+\TeXexample
+\def\dbl{%
+ \nextcolumn{\vrule width\thinsize
+ \hskip\thinsize\vrule width\thinsize}}
+|endTeXexample
+
+