Automatically counting table rows

I’ve just read the blog post Automatic Table Row Numbers in LaTeX by Alexander O’Connor, while reading it came to my mind how to use a feature of the array package to automatize such tasks. The array syntax >{command} allows to include commands in row formating parameters that will be executed with each cell. Here’s a short compilable demonstration example:

\multicolumn{1}{r}{No.} & text \\\hline
 & first  \\
 & second \\
 & third  \\
 & fourth


Table row counting

Of course it would be only useful with longer tables. But this example is also intended to show how to execute commands for certain cells in general.

10. September 2009 by stefan
Categories: Uncategorized | 1 comment

One Comment

  1. Pingback: ?????????????? « Thai LaTeX and MATLAB

Leave a Reply

Required fields are marked *