1

This question already has an answer here:

I can't imagine that this hasn't been asked before, but googling doesn't help me find the answer.

Creating a table with 9 columns using the shortcut {*9{l}} works fine:

\documentclass{article}
\begin{document}
\begin{tabular}{*9{l}}
\end{tabular}
\end{document}

But when I get into double digits, I get an error:

\documentclass{article}
\begin{document}
\begin{tabular}{*10{l}}
\end{tabular}
\end{document}

! LaTeX Error: Illegal character in array arg.

How can I use the shortcut {*} with >9 columns?

marked as duplicate by Sverre, Community Sep 4 '15 at 10:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Maybe \begin{tabular}{*{10}{l}}? Seemed to work for me. – moewe Sep 4 '15 at 10:06
2

You will have to wrap the relevant number into curly braces if it is not single digit.

So

\documentclass{article}
\begin{document}
\begin{tabular}{*{12}{l}}
1&2&3&4&5&6&7&8&9&10&11&12\\
\end{tabular}
\end{document}

should cut it.

  • I usually wait 24+ hrs before accepting an answer, but I can't imagine anyone else wanting to provide an alternative answer (that's better) than this. – Sverre Sep 4 '15 at 10:10
  • @Sverre An alternative answer (only to support you imagination}: \documentclass{article} \begin{document} \catcode`?=\active \def?{12} %\begin{tabular}{{12}{l}} \begin{tabular}{?{l}} 1&2&3&4&5&6&7&8&9&10&11&12\\ \end{tabular} \end{document} :-) – Przemysław Scherwentke Sep 4 '15 at 11:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.