Quantcast
Channel: how to import CSV table with header containing spaces - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 3

Answer by Thomas F. Sturm for how to import CSV table with header containing spaces

$
0
0

As I have written in my comment, all depends on how to use the data. csvsimple has no problem with spaces inside the header as far as you do not create automated macros with head to column names.

An example usage is the following:

\documentclass{article}\usepackage{csvsimple,array,filecontents,booktabs}\begin{filecontents*}{forum_posts_table_1.csv}    posts per author,sentences per post,quoted sentences per post,EREs per post,mentions per ERE    3.1,23.83454,2313.27,13453453.8,2464642.43    4.1,23.83454,2313.27,13453453.8,2464642.43    5.1,23.83454,2313.27,13453453.8,2464642.43\end{filecontents*}\begin{document}\newcommand\myhead[1]{\parbox[t]{5em}{\centering\bfseries#1\par\kern1mm}}\csvreader[no head,column count=5,tabular=rrrrr,  table head=\toprule,  late after first line=\\\midrule,  table foot=\bottomrule  ]%{forum_posts_table_1.csv}{}{%  \csviffirstrow{\myhead{\csvcoli} & \myhead{\csvcolii} & \myhead{\csvcoliii}& \myhead{\csvcoliv} & \myhead{\csvcolv}    }{\csvlinetotablerow}}\end{document}

enter image description here


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>