2
\begin{figure}
\csvautobooktabular[]{csvs/some-ttests.csv}
\end{figure}

This produces way too large a table (cut off on the left side), so I want to split it up into multiple tabulars, one for columns 1,3,4, one for columns 1,6,7, one for columns 1,9,10, etc., where the first column always contains the information about what is stored in the rows and the other two are the actual data.

How do I limit the columns printed by csvsimple to a selection, say 1,3,4, for example?

1

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}

enter image description here

enter image description here

  • Appreciate the answer. A tiny bit too late for me, but the next person having this question will find this very useful. – User1291 Apr 24 at 4:54
  • 1
    @User1291 Thank you! I was searching for old questions to be answered :) – CarLaTeX Apr 24 at 4:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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