csvsimple
allows you to choose which columns of your .csv
are to print, just put only the column name \csvcol...
you need in the command list or your \csvreader
macro.
In the following MWE filecontents
package and environment are used only to create the file some-ttests.csv
. Of course, you don't need them in your actual document, since you've already got the file.
\documentclass{article}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{csvsimple}
\csvstyle{mystyle}{
tabular=ccc,
table head=\toprule,
table foot=\bottomrule,
no head,
late after line=\\,
late after first line=\\\midrule,
}
\usepackage{filecontents}
\begin{filecontents*}{some-ttests.csv}
one, two, three, four, five, six, seven, eight, nine, ten
1,2,3,4,5,6,7,8,9,10
3,6,5,5,2,3,4,5,3,1
2,5,7,1,6,5,3,9,5,1
7,3,0,5,5,2,0,8,4,4
\end{filecontents*}
\title{Title}
\begin{document}
\begin{table}[htb]
\centering
\caption{Table with comuns 1, 3 and 4\label{tab134}}
\csvreader[mystyle]{some-ttests.csv}{}{\csvcoli & \csvcoliii & \csvcoliv}
\end{table}
\begin{table}[htb]
\centering
\caption{Table with comuns 1, 6 and 7\label{tab167}}
\csvreader[mystyle]{some-ttests.csv}{}{\csvcoli & \csvcolvi & \csvcolvii}
\end{table}
\begin{table}[htb]
\centering
\caption{Table with comuns 1, 9 and 10\label{tab1910}}
\csvreader[mystyle]{some-ttests.csv}{}{\csvcoli & \csvcolix & \csvcolx}
\end{table}
\begin{table}[htb]
\centering
\caption{Complete table for comparison\label{tabtot}}
\csvreader[
tabular=*{10}{c},
table head=\toprule,
table foot=\bottomrule,
no head,
late after line=\\,
late after first line=\\\midrule, ]{some-ttests.csv}{}{\csvlinetotablerow}
\end{table}
\end{document}
Best Answer
Here it is. I slightly simplified and improved your code: