Reputation: 119
The following code for creating Latex table from csv file is missing horizontal line on top of the table.
\documentclass{article}
\usepackage{csvsimple}
% Make csv in question
\begin{filecontents*}{check.csv}
labels,names,A,C,V,tools
a,example,838,663,683,
b,otter,353,215,192,
d,\textbf{broccoli},79,79,117,
e,fibredensityandcrosssection,1086,849,868,
ad,hcp-prefree:exec-centos7.freebuild-centos4-latest,70,76,157,
ar,shots47s\_fmriprep-1.2.3,,,,453
\end{filecontents*}
\begin{table*}[!ht]
\csvreader[%
tabular={|c|c|c|c|c|c|},
table head = \textbf{Labels} &\textbf{{names}} & \textbf{A} & \textbf{C} & \textbf{V} & \textbf{T}\\\hline,
late after line= \\,
late after last line=\\\hline %
]{check.csv}{labels=\labels,names=\names,A=\A,C=\C,V=\V,tools=\tools}%
{\labels & \names & \A & \C & \V & \tools}
\centering
\caption{\label{table1}Number by category}
\end{table*}
\end{document}
How we can add top horizontal line on top of table?
Upvotes: 1
Views: 9220
Reputation: 38942
Please note that building such a data prison is bad style. Have a look at http://betterposters.blogspot.de/2012/08/the-data-prison.html , https://www.inf.ethz.ch/personal/markusp/teaching/guides/guide-tables.pdf or https://wiert.me/2014/04/03/andre-vatter-google-wie-tabellen-eigentlich-aussehen-sollten-%EF%BB%BF/ for some guides about nice looking tables.
\documentclass{article}
\usepackage{csvsimple}
% Make csv in question
\begin{filecontents*}{check.csv}
labels,names,A,C,V,tools
a,example,838,663,683,
b,otter,353,215,192,
d,\textbf{broccoli},79,79,117,
e,fibredensityandcrosssection,1086,849,868,
ad,hcp-prefree:exec-centos7.freebuild-centos4-latest,70,76,157,
ar,shots47s\_fmriprep-1.2.3,,,,453
\end{filecontents*}
\begin{document}
\begin{table*}[!ht]
\csvreader[%
tabular={|c|c|c|c|c|c|},
table head = \hline\textbf{Labels} &\textbf{{names}} & \textbf{A} & \textbf{C} & \textbf{V} & \textbf{T}\\\hline,
late after line= \\,
late after last line=\\\hline %
]{check.csv}{labels=\labels,names=\names,A=\A,C=\C,V=\V,tools=\tools}%
{\labels & \names & \A & \C & \V & \tools}
\centering
\caption{\label{table1}Number by category}
\end{table*}
\end{document}
Upvotes: 4