I'm looking for a way to create a command with which Latex can automatically generate a table with a given amount of columns, and automatically fills in the column numbers as headers.
I'm looking for something like this:
\newcommand{\CountBox}[1]{
\begin{flushright}
\begin{tabular}{*{#1}{|l}}
\hline
\multicolumn{1}{|c|}{1} #1 \\ \hline
#1 \\ \hline
\end{tabular}
\end{flushright}
}
Where the following command creates the following table:
\CountBox{6}
And the following command creates the following table:
\CountBox{3}
I seem to get stuck on having to manually input the ampersands into the multicolumn command (have tried \loop, \while, and \expandafter)
Thanks for the help!
Just in case the original code for the 6 column table:
\begin{flushright}
\begin{tabular}{*{7}{|l}}
\hline
\multicolumn{1}{|c|}{1} & 2 & 3 & 4 & 5 & 6 \\ \hline
& & & & & \\ \hline
\end{tabular}
\end{flushright}





1in its cell and not the others ? – Jan 04 '19 at 18:40