[Tex/LaTex] Table csvreader with eleven columns

csvsimpletables

The \csvreader to build a table without a header with eleven columns does not seem to work.

\documentclass{standalone}
\usepackage{array}
\usepackage{longtable}
\usepackage{csvsimple}
\begin{filecontents*}{data.csv}
0.1,0.4,0.7,1.0,1.3,1.6,1.9,2.2,2.5,2.8,3.1,3.4
0.2,1.0,1.8,2.6,3.4,4.2,5.0,5.8,6.6,7.4,8.2,9.0
\end{filecontents*}

\begin{document}
\begin{tabular}{cccccccccccc}
    \hline
    \csvreader[no head,table head=\hline,late after line=\\\hline]{data.csv}{1=\one,2=\two,3=\three,4=\four,5=\five,6=\six,7=\seven,8=\eight,9=\nine,10=\ten,11=\eleven}
    {\thecsvrow & \one & \two & \three & \four & \five & \six & \seven & \eight & \nine & \ten & \ten & \eleven}
\end{tabular}

\end{document}

Raises the following error:

Package pgfkeys Error: I do not know the key '/csv head/11', to which you passed '\eleven ', and I am going to ignore it. Perhaps you misspelled it. ... & \eight & \nine & \ten & \ten & \eleven}

Taking out the eleventh column from the csvreader solves the problem, but is there a solution or a workaround to obtain eleven columns or more?

Best Answer

The csvsimple package assumes at most ten columns, by default, but the number is adjustable by setting the column count key.

\begin{filecontents*}{\jobname.csv}
0.1,0.4,0.7,1.0,1.3,1.6,1.9,2.2,2.5,2.8,3.1,3.4
0.2,1.0,1.8,2.6,3.4,4.2,5.0,5.8,6.6,7.4,8.2,9.0
\end{filecontents*}

\documentclass{standalone}
\usepackage{array}
\usepackage{longtable}
\usepackage{csvsimple}

\begin{document}
\begin{tabular}{cccccccccccc}
\hline
\csvreader[
  column count=11,
  no head,
  table head=\hline,
  late after line=\\\hline
]{\jobname.csv}{
  1=\one, 2=\two, 3=\three, 4=\four,
  5=\five, 6=\six, 7=\seven, 8=\eight,
  9=\nine, 10=\ten, 11=\eleven
}
{\thecsvrow & \one & \two & \three & \four & \five & \six & \seven & \eight & \nine & \ten & \eleven}
\end{tabular}

\end{document}

enter image description here

Related Question