# Making text a single row or column centered or bold under (csvsimple)

With some help here I was able to import tables read from a csv file using this code:

\documentclass{article}
\usepackage{array,booktabs,longtable,csvsimple}

\usepackage{filecontents}

\begin{filecontents*}{NewTextDocument.csv}
name,job,age,profile
John,student,21,John has always been a very diligent student his marks always being among the best
Frederik,student,18,Frederik has not been a very diligent student
Johnson,professor,49,Johnson is just a professor ...
\end{filecontents*}

\makeatletter
\csvset{
}
\makeatother

\begin{document}

\csvautobooklongtable[
separator=comma,
my first column width=3cm,
late after line={\\\midrule},
late after last line={\end{longtable}}
]{NewTextDocument.csv}

\csvautobooklongtable[
separator=comma,
my second column width=3cm,
late after line={\\\hline},
late after last line={\\\hline\end{longtable}}
]{NewTextDocument.csv}

\end{document}


However, now I'm trying to make a little change by centering and "bolding" the text of a whole row or column but I haven't had any luck yet. Can anyone help me modify the code above to do so?

EDIT: And I would also like to label and add a caption to the tables, which I'm also struggling with.

• Welcome to TeX SX! Would you mind posting a full compilable code? Oct 7 '17 at 22:44
• @Bernard I thought I did. The code above should actually compile.. Oct 8 '17 at 0:27
• Which row should be bold? The column heads? Oct 8 '17 at 15:48
• Yes, bold and centered. I also need to add a caption and a label to the table. Oct 8 '17 at 17:21

You could use \csvreader:

\documentclass{article}
\usepackage{array,booktabs,longtable,csvsimple}
\renewcommand{\arraystretch}{1.1}

\usepackage{filecontents}
\begin{filecontents*}{NewTextDocument.csv}
name,job,age,profile
John,student,21,John has always been a very diligent student his marks always being among the best
Frederik,student,18,Frederik has not been a very diligent student
Johnson,professor,49,Johnson is just a professor ...
\end{filecontents*}

\begin{document}
Table~\ref{myfirsttable} is with \texttt{booktabs}.

longtable={*3{c}p{19em}},
\textbf{Name} & \textbf{Job} & \textbf{Age} & \multicolumn{1}{c}{\textbf{Profile}} \\
\midrule
\toprule
\textbf{Name} & \textbf{Job} & \textbf{Age} & \multicolumn{1}{c}{\textbf{Profile}} \\
\midrule
late after line=\\\midrule,
late after last line=\\\bottomrule,
]{NewTextDocument.csv}{1=\name,2=\job,3=\age,4=\profile}{\name & \job  & \age & \profile}

Table~\ref{mysecondtable} is without \texttt{booktabs}.

longtable={|*3{c|}p{19em}|},
\textbf{Name} & \textbf{Job} & \textbf{Age} & \multicolumn{1}{c|}{\textbf{Profile}} \\
\hline
\hline
\textbf{Name} & \textbf{Job} & \textbf{Age} & \multicolumn{1}{c|}{\textbf{Profile}} \\
\hline
late after line=\\\hline,
]{NewTextDocument.csv}{1=\name,2=\job,3=\age,4=\profile}{\name & \job  & \age & \profile}

Table~\ref{mythirdtable} is my suggestion.

longtable={l*2{c}p{19em}},
table head={\caption{With few lines\label{mythirdtable}}\\\toprule
\textbf{Name} & \textbf{Job} & \textbf{Age} & \multicolumn{1}{c}{\textbf{Profile}} \\
\midrule