# wrapping text in table

For some reason, the text in my table is not wrapping up and I keep getting the error: Extra alignment tab has been changed to \cr.. can anyone help with making a simple table with wrapping the text: below is the MWE:

   %---------------------Preamble---------------%
\documentclass[twoside,b5paper,9.5pt,openright]{book}
\usepackage[total={13cm,19.5cm},top=2.5cm,bottom=2.0cm,left=2.0cm,right=2.0cm, includefoot]{geometry}
\usepackage[english]{babel}
\usepackage{charter}
\usepackage{microtype}          % removes extra spacing between text
\usepackage{graphicx}           % include graphs/ figures  in the file
\usepackage{array,threeparttable}       % to add footnotes to the tables
\usepackage{booktabs}
\usepackage{caption}    % to create some space between table caption and table, otherwise there was no space
\captionsetup[table]{font=small,skip=0pt}
\usepackage{subfig}
\usepackage{float}              % figures as 6 (a), 6 (b) etc.
\usepackage{tabu}
\usepackage{tikz}
\raggedbottom
\begin{document}
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[ht]
\scriptsize
\centering
\begin{threeparttable}
\begin{tabular}{p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}}
\toprule
& \textbf{Overall} & \textbf{Starting} & \textbf{treatments} & \textbf{processes} & \textbf{Average} & \textbf{error (\%)} \\
\midrule
R2    & 0.3  & 0.6  & 0.5  & 0.7  & 0.3  & 8 \\
C     & 2   & 17   & 2   & 5   & 2   & 8 \\
k     & 6    & 0     & 2    & 226   & 9    & 1 \\
Efficiency of testing system* & 74    & 9    & 8    & 5    & 8    & 0 \\
St.dev. ** & 1    & 1    & 1    & 1    & 2    & - \\
\bottomrule
\end{tabular}%
\label{tab:first-modeldata}%
\end{threeparttable}
\end{table}%

• You only specified 6 columns but you are wanting 7 columns. Add one more p{1cm} to the table definition. – R. Schumacher Mar 24 '15 at 2:14
• @R.Schumacher How can I add vertical line after the first column. I am trying to do {p|{1cm}}, but this does not work – abhishek Mar 24 '15 at 2:26
• You really do not want to use vertical rules if you are using booktabs to format the table. See the documentation for the package. That recommends not using them. If you must use them for some reason, don't use the booktabs commands for this table, at least. (But best not to use them.) – cfr Mar 24 '15 at 2:41
• You've asked for paragraph alignment so the contents of the cells will be aligned on the left. It isn't clear what you want aligned with what. – cfr Mar 24 '15 at 2:42

Here's a version with siunitx to align the numbers and booktabs rules:

\documentclass[twoside,b5paper,openright]{book}
\usepackage[total={13cm,19.5cm},top=2.5cm,bottom=2.0cm,left=2.0cm,right=2.0cm,includefoot]{geometry}
\usepackage{charter}
\usepackage{microtype}
\usepackage{array,threeparttable,siunitx}
\usepackage{booktabs}
\usepackage{caption}
\captionsetup[table]{font=small,skip=0pt}
\usepackage{subfig}
\usepackage{float}
\raggedbottom
\begin{document}
\begin{table}[ht]
\scriptsize
\centering
\begin{threeparttable}
\begin{tabular}{p{1cm}*{6}{S}}
\toprule
& \textbf{Overall} & \textbf{Starting} & \textbf{treatments} & \textbf{processes} & \textbf{Average} & \textbf{error (\%)} \\\midrule
R2    & 0.3  & 0.6  & 0.5  & 0.7  & 0.3  & 8 \\
C     & 2   & 17   & 2   & 5   & 2   & 8 \\
k     & 6    & 0     & 2    & 226   & 9    & 1 \\
Efficiency of testing system* & 74    & 9    & 8    & 5    & 8    & 0 \\
St.dev.** & 1    & 1    & 1    & 1    & 2    & \multicolumn{1}{c}{--} \\\bottomrule
\end{tabular}%
\label{tab:first-modeldata}%
\end{threeparttable}
\end{table}
\end{document}


If you really need vertical rules:

  \begin{table}[ht]
\scriptsize
\centering
\begin{threeparttable}
\begin{tabular}{p{1cm}|*{6}{S}}
\hline
& \textbf{Overall} & \textbf{Starting} & \textbf{treatments} & \textbf{processes} & \textbf{Average} & \textbf{error (\%)} \\\hline
R2    & 0.3  & 0.6  & 0.5  & 0.7  & 0.3  & 8 \\
C     & 2   & 17   & 2   & 5   & 2   & 8 \\
k     & 6    & 0     & 2    & 226   & 9    & 1 \\
Efficiency of testing system* & 74    & 9    & 8    & 5    & 8    & 0 \\
St.dev.** & 1    & 1    & 1    & 1    & 2    & \multicolumn{1}{c}{--} \\\hline
\end{tabular}%
\label{tab:first-modeldata}%
\end{threeparttable}
\end{table}


But the result is (predictably) much uglier:

booktabs tables really do look nicer.