<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//en">

<!–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 &ndash; 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>`&#92;input TABLES'</TT> in your T<SMALL>E</SMALL>X file, somewhere before you first use them. The macros available are listed in Table&nbsp;<A HREF="tables-doc_ct.html#tab:one"><IMG ALT="[*]" SRC="crossref.png"></A> and Table&nbsp;<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="

\begin{table}\begintable
{\sl Macro name} \vert {\sl Description} \cr
\hbox{\tt\...
...t\hbox{\char'174}}, but puts in a
thick vertical rule.
\endtable
\end{table}

"></TD></TR> </TABLE> </DIV><P></P> <BR>

<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="

\begin{table}\begintable
\hbox{\tt\char'134thicksize}={\em dimen}
\vert \para{T....
.....ff the diagnostic messages concerning rows and
columns.}
\endtable
\end{table}

"></TD></TR> </TABLE> </DIV><P></P> <BR> The general idea is that you start your table with the command <TT>&#92;begintable</TT>, type your entries in one row at a time, then finish with the command <TT>&#92;endtable</TT>. To specify a row, enter the individual entries into your T<SMALL>E</SMALL>X file, separating each column entry with a <TT>&#124;</TT>, an <TT>&#38;</TT>, or a <TT>&#92;&#124;</TT>. A <TT>&#124;</TT> will separate the adjoining columns with a thin vertical rule, an <TT>&#38;</TT> will leave out the vertical rule, and a <TT>&#92;&#124;</TT> will separate the columns with a thick vertical rule. To end one row and start another, use either a <TT>&#92;cr</TT>, a <TT>&#92;crnorule</TT>, or a <TT>&#92;crthick</TT>. A <TT>&#92;cr</TT> separates the rows with a thin horizontal rule; a <TT>&#92;crnorule</TT> leaves out the horizontal rule, while <TT>&#92;crthick</TT> inserts a thick horizontal rule. Then end the last row with an <TT>&#92;endtable</TT>.

<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>&#92;cr...</TT>, but <EM>must</EM> end with an <TT>&#92;endtable</TT>. If you put a <TT>&#92;cr</TT> and an <TT>&#92;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>&#92;omit</TT>, a T<SMALL>E</SMALL>X primitive, or <TT>&#92;multispan</TT>. See notes below). The table will be centered in a <TT>&#92;hbox</TT> of width <TT>&#92;hsize</TT>, unless you have turned table centering off (see the commands <TT>&#92;centeredtables</TT> and <TT>&#92;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>&#124;</TT>'s or <TT>&#38;</TT>'s or <TT>&#92;cr</TT>'s. This diagnostic feature can be disabled by saying <TT>&#92;tableinfofalse</TT> (and restarted by saying <TT>&#92;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>&#92;multispan</TT>): <PRE> 2height hh depth dd width 0ptThe Top Line Entry 1 | Entry 2 Entry 3 | Entry 4 </PRE> These commands produce Table&nbsp;<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="

\begin{table}\begintable
\multispan{2}\vrule height hh depth dd width 0pt\hfill ...
...ll\crthick
Entry 1 \vert Entry 2 \cr
Entry 3 \vert Entry 4 \endtable
\end{table}

"></TD></TR> </TABLE> </DIV><P></P> <BR>

<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>&#92;noncenteredtables</TT> command. Consider the two tables here (Table&nbsp;<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="

\begin{table}\noncenteredtables
\hbox to \hsize {
\begintable
Item ABC \vert Ite...
......r
Data 333 \vert Data 444 \cr
Data 555 \vert Data 666 \endtable
}
\end{table}

"></TD></TR> </TABLE> </DIV><P></P> <BR>

<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>&#92;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>&#92;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>&#92;thicksize</TT> and <TT>&#92;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>&#92;multispan</TT> or an <TT>&#92;omit</TT> in the first column of a row, you will lose the effect of the <TT>&#92;tstrut</TT> within that row and must specify it yourself. See the example above. </DD> <DT>4.</DT> <DD>Use of <TT>&#92;multispan</TT> and <TT>&#92;omit</TT> will cause the default centering of the entry to be lost; if you want it centered, put an <TT>&#92;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>&#92;hfill</TT> on the left or right as desired; the <TT>&#92;hfill</TT> will override the default <TT>&#92;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>&#92;line</TT> has been replaced with <TT>&#92;tableline</TT>, with <TT>&#92;tableline</TT> being defined as <PRE> </PRE>

<P> The <TT>&#92;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>