How can I make a custom macro that creates an array with some number of columns, but I'm having trouble forcing the macro to expand inline. In test.sty:
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{test}
\RequirePackage{tikz}
\RequirePackage{array}
\newcommand{\generateColumns}[1]{%
\foreach \n in {1,...,#1}{c}
}
\newcommand{\myCustomArray}[2]{%
\begin{array}{\generateColumns{#1}}
#2
\end{array}
}
But \generateColumns{#1} is evidently passed to \begin{array} literally! How can I force expansion of a \newcommand macro in this context (or even better, change \generateColumns to be inline since I only use it once)?