[Tuglist] Enumeration in tabular
E. Krishnan
tuglist@tug.org.in
Wed, 27 Mar 2002 13:52:48 +0530 (IST)
On Wed, 27 Mar 2002, H.S.Rai wrote:
> Is \thecounter equvalent to \arabic{counter} ?
Though \thecounter is by default the same as \arabic{counter}, the two are
not exactly identical, since \thecounter can be redefined and can be even
defined to be made up from several other counters. For example, in the
documentclass book, \thesection is defined as
\arbic{chapter}.\arabic{section} so that a call to \thesection in Chapter
5, Section 2 produces 5.2
By the way, if you want a row wihout the serial number, such as the
column heads, use \multicolumn as in the following
\newcounter{rowno}
\setcounter{rowno}{0}
\newcommand{\slno}{\addtocounter{rowno}{1}\therowno}
\newcolumntype{n}{>{\slno}r}
\begin{tabular}{|n|c|c|c|c|}
\hline
\multicolumn{1}{|c|}{Sl.No} & Col 1 & Col 2 & Col 3\\
\hline
& the & first & row\\
\hline
& the & second & row\\
\hline
& the & third & row\\
\hline
\end{tabular}
--
Krishnan