I have a csv that contains column names with digits. Somehow this seems to be a problem for csvsimple, but I can't quite figure out why and how to deal with it correctly.
Here's what I want to achieve:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{csvsimple}
\usepackage{filecontents}
\begin{filecontents*}{ndcgs.csv}
system;ndcg5;ndcg10;ndcg15;ndcg20;ndcg30;ndcg100;ndcg200;ndcg500;ndcg1000
A;0.632;0.566;0.531;0.533;0.511;0.475;0.396;0.301;0.301
B;0.646;0.615;0.598;0.588;0.563;0.536;0.517;0.401;0.363
C;0.557;0.567;0.589;0.576;0.573;0.511;0.478;0.429;0.380
D;0.644;0.577;0.538;0.540;0.518;0.473;0.398;0.303;0.302
E;0.291;0.304;0.302;0.330;0.351;0.361;0.281;0.238;0.236
\end{filecontents*}
\begin{document}
\csvstyle{myTableStyle}{tabular=lc,
table head=\toprule system & ndcg5\\\midrule,
table foot=\bottomrule,
head to column names,
separator=semicolon}
\csvreader[myTableStyle]{ndcgs.csv}{}%
{\system & \ndcg5}
\end{document}
The error message complains about an undefined control sequence, related to the column name "ndcg5":
! Undefined control sequence.
\csv@tablehead ->\toprule
system & ndcg5\\\midrule
l.25 {\system & \ndcg5}
I tried to prevent this by using \csvcolii
etc but still the same error.
I found that the following works:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{csvsimple}
\usepackage{filecontents}
\begin{filecontents*}{ndcgs.csv}
system;ndcg5;ndcg10;ndcg15;ndcg20;ndcg30;ndcg100;ndcg200;ndcg500;ndcg1000
A;0.632;0.566;0.531;0.533;0.511;0.475;0.396;0.301;0.301
B;0.646;0.615;0.598;0.588;0.563;0.536;0.517;0.401;0.363
C;0.557;0.567;0.589;0.576;0.573;0.511;0.478;0.429;0.380
D;0.644;0.577;0.538;0.540;0.518;0.473;0.398;0.303;0.302
E;0.291;0.304;0.302;0.330;0.351;0.361;0.281;0.238;0.236
\end{filecontents*}
\begin{document}
\begin{tabular}{lc}%
\bfseries system & \bfseries ndcg-5%
\csvreader[separator=semicolon]{ndcgs.csv}{}%
{\\ \csvcoli & \csvcolii}%
\end{tabular}
\end{document}
But I don't see how this approach would allow me to define the table layout (regarding toprule, midrule etc.) in the same way as in the example above.
Can anyone help?