[Tuglist] Enumeration in tabular

E. Krishnan tuglist@tug.org.in
Mon, 25 Mar 2002 19:20:05 +0530 (IST)


On Mon, 25 Mar 2002, H.S.Rai wrote:

> Can we automatically give number in first column of a
> tabular ( which is in general Sr. No. ) like enumerate?


A simple trick using the package array is as follows

\documentclass{article}
\usepackage{array}

\begin{document}

\newcounter{rowno}
\setcounter{rowno}{0}
\newcommand{\slno}{\addtocounter{rowno}{1}\therowno}
\newcolumntype{n}{>{\slno}r}

\begin{tabular}{|n|c|c|c|c|}
\hline
& the & first & row\\
\hline
& the & second & row\\
\hline
& the & third & row\\
\hline
\end{tabular}

\end{document}



-- 
Krishnan