\documentclass[a4paper]{article} % \usepackage{times} \usepackage{easytable}% \let\package\texttt % so \package{foo} comes out in \tt \let\envname\textsf % so \envname{foo} comes out as \sf \newbox\tempbox \def\BOX{% \setbox\tempbox\hbox\bgroup \begin{minipage}{0.9\textwidth} } \def\endBOX{% \end{minipage} \egroup \par\bigskip \begin{center} \fboxsep=10pt\fbox{\box\tempbox} \end{center} \bigskip\par } \title{The package \package{easytable}} \author{Enrico Bertolazzi\\\\ Laboratorio di Matematica Applicata\\ Dipartimento di Ingegneria Civile ed Ambientale\\ Universit\`a degli Studi di Trento\\ Mesiano, Trento, Italy\\\\ \texttt{bertolaz@ing.unitn.it}} \date{} \begin{document} \maketitle \begin{abstract} The \package{easytable} package is a macro package for writing tables, with equal column widths or equal rows heights or both, with various kinds of rules~(lines) between rows and columns. It uses an array/tabular-like syntax. \end{abstract} \tableofcontents \section{Some examples with \package{easytable}} Load the package in the usual way: \begin{BOX} \begin{verbatim} \documentclass{article} . . \usepackage[thinlines,thiklines]{easytable} . . \end{verbatim} \end{BOX} The options \texttt{thinlines}, and \texttt{thiklines} are self explanatory. \package{easytable} provides the \envname{TAB}~environment which is a simple re-implementation of the array/tabular environment, with some limitation and some additional features. The syntax is \begin{BOX} \begin{verbatim} \begin{TAB}`(x)'`[2pt]'`{cc...c}'`{cc...c}' a & b & ... & n \\ . \end{TAB} \end{verbatim} \end{BOX} \begin{description} \item[(x)] is an optional parameter, if present it specify if you want to balance the rows or the column or both, as this table shows: \begin{center} \begin{tabular}{|l|l|} \hline value of $x$ & effect \\ \hline \verb+r+ & equal rows heights \\ \verb+c+ & equal column widths \\ \verb+b+ & equal rows heights and equal column widths \\ \verb+e+ & equal rows heights and column widths \\ \hline \end{tabular} \end{center} \item[]\verb+[2pt]+ an optional parameter that specify the amount of extra space around the item in the \envname{TAB} environment. The default is \verb+2pt+. \item[the first] \verb+`{cc...c}'+ is the definition of the columns and their alignment. The possible alignment for the columns are: \begin{center} \begin{tabular}{|l|l|} \hline \verb+c+ & centering \\ \verb+l+ & flush left \\ \verb+r+ & flush right \\ \hline \end{tabular} \end{center} \item[the second] \verb+`{cc...c}'+ is the definition of the rows their alignment. The possible alignment for the rows are: \begin{center} \begin{tabular}{|l|l|} \hline \verb+c+ & centering \\ \verb+t+ & flush top \\ \verb+b+ & flush bottom \\ \hline \end{tabular} \end{center} \end{description} It is possible to produce rules between columns or rows as this example shows: \begin{BOX} \begin{verbatim} \begin{center} \begin{TAB}(b){|l:cr|}{|t;cb|} 1 & 1 & 1 \\ 1 & dummy & 1 \\ 1 & 1 & 1 \end{TAB} \\ \begin{TAB}(b){|r:cl|}{|b;ct|} 1 & 1 & 1 \\ 1 & dummy & 1 \\ 1 & 1 & 1 \end{TAB} \end{center} \end{verbatim} \end{BOX} which produce the following output: \begin{BOX} \begin{center} \begin{TAB}(b){|l:cr|}{|t;cb|} 1 & 1 & 1 \\ 1 & dummy & 1 \\ 1 & 1 & 1 \end{TAB} \\ \begin{TAB}(b){|r:cl|}{|b;ct|} 1 & 1 & 1 \\ 1 & dummy & 1 \\ 1 & 1 & 1 \end{TAB} \end{center} \end{BOX} The available rules for the rows and columns are \begin{center} \begin{tabular}{|l|l|} \hline nothing & no rule \\ \verb+|+ & solid line \\ \verb+:+ & dash line \\ \verb+;+ & dot-dash line \\ \verb+.+ & dotted line \\ \verb+0+ & solid line with size $1/5$ of normal line \\ \verb+1+ & solid line with size $1/4$ of normal line \\ \verb+2+ & solid line with size $1/3$ of normal line \\ \verb+3+ & solid line with size $1/2$ of normal line \\ \verb+4+ & equivalent to \verb+|+ \\ \verb+5+ & solid line with size $2$ times of normal line \\ \verb+6+ & solid line with size $3$ times of normal line \\ \verb+7+ & solid line with size $4$ times of normal line \\ \verb+8+ & solid line with size $5$ times of normal line \\ \verb+9+ & solid line with size $6$ times of normal line \\ \hline \end{tabular} \end{center} The main feature of the \envname{TAB}~environment is that it is reentrant: \begin{BOX} \begin{verbatim} \begin{center} \fbox{\begin{TAB}{0c.c9}{|c.c|} 1 & 2 \\ 3 & \begin{TAB}{c:c}{c:c} a & b \\ c & d \end{TAB} \end{TAB}} \end{center} \end{verbatim} \end{BOX} which produces \begin{BOX} \begin{center} \fbox{\begin{TAB}{0c.c9}{|c.c|} 1 & 2 \\ 3 & \begin{TAB}{c:c}{c:c} a & b \\ c & d \end{TAB} \end{TAB}} \end{center} \end{BOX} \section{Some example with balancing} Here it is showed the effect of various balancing \begin{BOX} \begin{verbatim} \begin{center} \begin{TAB}{|c|c|c|}{|c|c|c|} 1 & 22 & 333 \\ $\frac{1}{2}$ & 1 & 1 \\ $\frac{1}{\frac{1}{2}}$ & 1 & 1 \end{TAB} \hfil \begin{TAB}(r){|c|c|c|}{|c|c|c|} 1 & 22 & 333 \\ $\frac{1}{2}$ & 1 & 1 \\ $\frac{1}{\frac{1}{2}}$ & 1 & 1 \end{TAB} \hfil \begin{TAB}(c){|c|c|c|}{|c|c|c|} 1 & 22 & 333 \\ $\frac{1}{2}$ & 1 & 1 \\ $\frac{1}{\frac{1}{2}}$ & 1 & 1 \end{TAB} \\ \begin{TAB}(b){|c|c|c|}{|c|c|c|} 1 & 22 & 333 \\ $\frac{1}{2}$ & 1 & 1 \\ $\frac{1}{\frac{1}{2}}$ & 1 & 1 \end{TAB} \hfil \begin{TAB}(e){|c|c|c|}{|c|c|c|} 1 & 22 & 333 \\ $\frac{1}{2}$ & 1 & 1 \\ $\frac{1}{\frac{1}{2}}$ & 1 & 1 \end{TAB} \end{center} \end{verbatim} \end{BOX} which produce: \begin{BOX} \begin{center} \begin{TAB}{|c|c|c|}{|c|c|c|} 1 & 22 & 333 \\ $\frac{1}{2}$ & 1 & 1 \\ $\frac{1}{\frac{1}{2}}$ & 1 & 1 \end{TAB} \hfil \begin{TAB}(r){|c|c|c|}{|c|c|c|} 1 & 22 & 333 \\ $\frac{1}{2}$ & 1 & 1 \\ $\frac{1}{\frac{1}{2}}$ & 1 & 1 \end{TAB} \hfil \begin{TAB}(c){|c|c|c|}{|c|c|c|} 1 & 22 & 333 \\ $\frac{1}{2}$ & 1 & 1 \\ $\frac{1}{\frac{1}{2}}$ & 1 & 1 \end{TAB} \\ \begin{TAB}(b){|c|c|c|}{|c|c|c|} 1 & 22 & 333 \\ $\frac{1}{2}$ & 1 & 1 \\ $\frac{1}{\frac{1}{2}}$ & 1 & 1 \end{TAB} \hfil \begin{TAB}(e){|c|c|c|}{|c|c|c|} 1 & 22 & 333 \\ $\frac{1}{2}$ & 1 & 1 \\ $\frac{1}{\frac{1}{2}}$ & 1 & 1 \end{TAB} \end{center} \end{BOX} \section{An example with size} This example shows the use of various size rule in \envname{TAB} environment: \begin{BOX} \begin{verbatim} \begin{center} \begin{TAB}(e)[5pt]{0c1c2c3c4c5c6c7c8c9} {0c1c2c3c4c5c6c7c8c9} * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \end{TAB} \end{center} \end{verbatim} \end{BOX} which produce \begin{BOX} \begin{center} \begin{TAB}(e)[5pt]{0c1c2c3c4c5c6c7c8c9} {0c1c2c3c4c5c6c7c8c9} * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \\ * & * & * & * & * & * & * & * & * \end{TAB} \end{center} \end{BOX} \section{An example with reentrance} This example shows a slightly more complex (reentrant) definition in which the \envname{TAB}~environment is used: \begin{BOX} \begin{verbatim} \def\rec(#1){\expandafter\recurse#1-\end} \def\recurse#1#2\end{% \if\noexpand#1-\def\next##1##2{}% \else\let\next=\recursea\fi% \expandafter\next{#1}{#2}% }% \def\recursea#1#2{% \bgroup\ignorespaces% \begin{TAB}(e)[0pt]{0c1c2c3}{4c5c6c7}% $#1$&$#1$&\rec(#2)\\% $#1$&$#1$&$#1$\\% \rec(#2)&$#1$&$#1$% \end{TAB}% \egroup% } \begin{center} \recurse\clubsuit\diamondsuit\heartsuit\end \end{center} \end{verbatim} \end{BOX} It produces the following output: \typeout{This example can take a while to compile on small machine, please wait...} \def\rec(#1){\expandafter\recurse#1-\end} \def\recurse#1#2\end{% \if\noexpand#1-\def\next##1##2{}% \else\let\next=\recursea\fi% \expandafter\next{#1}{#2}% }% \def\recursea#1#2{% \bgroup\ignorespaces% \begin{TAB}(e)[0pt]{0c1c2c3}{4c5c6c7}% $#1$&$#1$&\rec(#2)\\% $#1$&$#1$&$#1$\\% \rec(#2)&$#1$&$#1$% \end{TAB}% \egroup% } \begin{center} \recurse\clubsuit\diamondsuit\heartsuit\end \end{center} \typeout{...thanks, I have done} \section{Another example with reentrance} The same example without balance \begin{BOX} \begin{verbatim} \def\rec(#1){\expandafter\recurse#1-\end} \def\recurse#1#2\end{% \if\noexpand#1-\def\next##1##2{}% \else\let\next=\recursea\fi% \expandafter\next{#1}{#2}% }% \def\recursea#1#2{% \bgroup\ignorespaces% \begin{TAB}[0pt]{0c1c2c3}{4c5c6c7}% $#1$&$#1$&\rec(#2)\\% $#1$&$#1$&$#1$\\% \rec(#2)&$#1$&$#1$% \end{TAB}% \egroup% } \begin{center} \recurse\clubsuit\diamondsuit\heartsuit\end \end{center} \end{verbatim} \end{BOX} It produces the following output: \typeout{This example can take a while to compile on small machine, please wait...} \def\rec(#1){\expandafter\recurse#1-\end} \def\recurse#1#2\end{% \if\noexpand#1-\def\next##1##2{}% \else\let\next=\recursea\fi% \expandafter\next{#1}{#2}% }% \def\recursea#1#2{% \bgroup\ignorespaces% \begin{TAB}[0pt]{0c1c2c3}{4c5c6c7}% $#1$&$#1$&\rec(#2)\\% $#1$&$#1$&$#1$\\% \rec(#2)&$#1$&$#1$% \end{TAB}% \egroup% } \begin{center} \recurse\clubsuit\diamondsuit\heartsuit\end \end{center} \typeout{...thanks, I have done} \end{document}