<!–Converted with LaTeX2HTML 2022 (Released January 1, 2022) –> <HTML lang="en"> <HEAD> <TITLE>Contents of tables-doc</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0"> <META NAME="Generator" CONTENT="LaTeX2HTML v2022">
<LINK REL="STYLESHEET" HREF="tables-doc.css">
</HEAD>
<BODY bgcolor="#ffffff" text="#000000" link="#9944EE" vlink="#0000ff" alink="#00ff00">
<DIV ALIGN="CENTER"> <FONT SIZE="+1">Making Tables with Macros</FONT></DIV>
<DIV ALIGN="CENTER"> Ray F. Cowan</DIV> <DIV ALIGN="CENTER"> 22 February 1985</DIV> Tables have traditionally been difficult to make using T<SMALL>E</SMALL>X – especially ruled tables. The file <TT>TABLES.TEX</TT> contains macros designed to prepare both ruled and unruled tables with considerably less effort. Note that <TT>TABLES.TEX</TT> can be used with any macro set; it does not depend on prior loading of <TT>PHYZZX</TT> or any other macro set, for example. One of the main advantages of this macro set is that you no longer need to design a preamble for the table; the macros will scan your table entries and construct a suitable preamble for you. To access the macros, say <TT>`\input TABLES'</TT> in your T<SMALL>E</SMALL>X file, somewhere before you first use them. The macros available are listed in Table <A HREF="tables-doc_ct.html#tab:one"><IMG ALT="[*]" SRC="crossref.png"></A> and Table <A HREF="tables-doc_ct.html#tab:two"><IMG ALT="[*]" SRC="crossref.png"></A>.
<P>
<BR><P></P>
<DIV class="CENTER"><A ID="tab:one"></A><A ID="52"></A>
<TABLE>
<CAPTION><STRONG>Table:</STRONG>
Description of simple table macros</CAPTION>
<TR><TD><IMG
STYLE="height: 314.00ex; " SRC="img1.png"
ALT="
<BR><P></P>
<DIV class="CENTER"><A ID="tab:two"></A><A ID="104"></A>
<TABLE>
<CAPTION><STRONG>Table:</STRONG>
Description of extended table macros</CAPTION>
<TR><TD><IMG
STYLE="height: 314.00ex; " SRC="img2.png"
ALT="
<P> Each row of the table must contain the same number of columns, otherwise unpredictable things will happen. Again the <EM>last row</EM> must <EM>not</EM> end with <TT>\cr...</TT>, but <EM>must</EM> end with an <TT>\endtable</TT>. If you put a <TT>\cr</TT> and an <TT>\endtable</TT> both on the last row, you won't like what happens.
<P> Each entry will be centered in it's column (unless you use <TT>\omit</TT>, a T<SMALL>E</SMALL>X primitive, or <TT>\multispan</TT>. See notes below). The table will be centered in a <TT>\hbox</TT> of width <TT>\hsize</TT>, unless you have turned table centering off (see the commands <TT>\centeredtables</TT> and <TT>\noncenteredtables</TT>).
<P> Each time a new table is encountered, a message similar to <TT>`[Nrows=xx, Ncols=yy]'</TT> is printed on your terminal, where <TT>xx</TT> is the number of rows and <TT>yy</TT> the number of columns discovered in your table. If you think they are incorrect, you may have left out some <TT>|</TT>'s or <TT>&</TT>'s or <TT>\cr</TT>'s. This diagnostic feature can be disabled by saying <TT>\tableinfofalse</TT> (and restarted by saying <TT>\tableinfotrue</TT>).
<P> truein <EM>An example</EM>
<P>
A simple 3-row, 2-column table with a header spanning two columns could be
specified as (see notes 3 and 4 below on the use of <TT>\multispan</TT>):
<PRE>
2height hh depth dd width 0ptThe Top Line
Entry 1 | Entry 2
Entry 3 | Entry 4
</PRE>
These commands produce Table <A HREF="tables-doc_ct.html#tab:three"><IMG ALT="[*]" SRC="crossref.png"></A>.
<BR><P></P>
<DIV class="CENTER"><A ID="tab:three"></A><A ID="151"></A>
<TABLE>
<CAPTION><STRONG>Table:</STRONG>
A sample table</CAPTION>
<TR><TD><IMG
STYLE="height: 314.00ex; " SRC="img3.png"
ALT="
<P> truein <EM>An example of non-centered tables</EM>
<P> Two or more tables can be placed side-by-side by using the <TT>\noncenteredtables</TT> command. Consider the two tables here (Table <A HREF="tables-doc_ct.html#tab:four"><IMG ALT="[*]" SRC="crossref.png"></A>):
<P>
<BR><P></P>
<DIV class="CENTER"><A ID="tab:four"></A><A ID="160"></A>
<TABLE>
<CAPTION><STRONG>Table:</STRONG>
Two non-centered tables aligned side-by-side</CAPTION>
<TR><TD><IMG
STYLE="height: 314.00ex; " SRC="img4.png"
ALT="
<P> These were produced by saying <PRE> Item ABC | Item DEF Item GHI | Item JKL Data 111 | Data 222 Data 333 | Data 444 Data 555 | Data 666 </PRE> Notice that tables of unequal height are aligned at the bottom.
<P> truein <FONT SIZE="+1">Usage notes:</FONT>
<P> <DL class="COMPACT"> <DT>1.</DT> <DD>Vertical spacing is done with a strut, called <TT>\tstrut</TT>, which is initially defined as 3.1ex high and 1.2ex deep. If you don't like the way it looks, you can redefine <TT>\tstrut</TT> to your own liking: <PRE> </PRE> where you specify your desired height <TT>hh</TT> and depth <TT>dd</TT>. </DD> <DT>2.</DT> <DD>You can control the thickness of the thin and thick rules through the use of <TT>\thicksize</TT> and <TT>\thinsize</TT>. You can turn off the rules entirely by saying <PRE> =0pt =0pt </PRE> for example </DD> <DT>3.</DT> <DD>If you use a <TT>\multispan</TT> or an <TT>\omit</TT> in the first column of a row, you will lose the effect of the <TT>\tstrut</TT> within that row and must specify it yourself. See the example above. </DD> <DT>4.</DT> <DD>Use of <TT>\multispan</TT> and <TT>\omit</TT> will cause the default centering of the entry to be lost; if you want it centered, put an <TT>\hfil</TT> on each side of the entry, as in the example above. </DD> <DT>5.</DT> <DD>To override the default centering action, include an <TT>\hfill</TT> on the left or right as desired; the <TT>\hfill</TT> will override the default <TT>\hfil</TT>. </DD> </DL>
<P> truein <FONT SIZE="+1">Local modifications for use with L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X:</FONT>
<P> truein This macro package was originally written for use with plain T<SMALL>E</SMALL>X. Bob Taylor has made changes for it to be used as a style option in L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X. The plain T<SMALL>E</SMALL>X command <TT>\line</TT> has been replaced with <TT>\tableline</TT>, with <TT>\tableline</TT> being defined as <PRE> </PRE>
<P> The <TT>\documentstyle</TT> command in your L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X file should look something like: <PRE> </PRE>
<P>
<HR>
</BODY> </HTML>