0

As the title says I'm getting multiple errors, all I did was copy and paste and edit the entries in my table, but now I'm getting the following errors popping up multiple times each:

! Missing \endgroup inserted.\endgroup \end{tabu},

! Undefined control sequence.\tabu@cellralign ->\tabu@verticalspacing \end{tabu}

! Missing \cr inserted.\cr \end{tabu}

Here are the packages I am using at the moment:

\documentclass{article}
\pagestyle{headings}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{cancel}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage{tabu}
\usepackage{array}

Here is the code for the "successful" table:

\begin{tabu}{| l | l | l | l |}
\hline
\multicolumn{4}{|l|}{List of Samples by Row} \\
\hline
\hline Sample Number & Entry 1 & Entry 2 & Entry 3 \\
\hline 1 & 5 & 4 & 3 \\
\hline 2 & 5 & 4 & 2  \\
\hline 3 & 5 & 4 & 1 \\
\hline 4 & 5 & 3 & 2 \\
\hline 5 & 5 & 3 & 1 \\
\hline 6 & 5 & 2 & 1 \\
\hline 7 & 4 & 3 & 2 \\
\hline 8 & 4 & 3 & 1 \\
\hline 9 & 4 & 2 & 1 \\
\hline 10 & 3 & 2 & 1 \\
\hline
\end{tabu} 

Here is the code for the "unsuccesful" attempt:

\begin{tabu}{| l | l | l | l | l |}
\hline
\multicolumn{5}{|l|}{List of Sample Values & Calculated Sample Means} \\
\hline
\hline Sample Number & Entry 1 & Entry 2 & Entry 3 & Sample Mean \\
\hline 1 & 5.89 & 6.2 & 5.76 & 5.95 \\
\hline 2 & 5.89 & 6.2 & 5.33 & 5.80 \\  
\hline 3 & 5.89 & 6.2 & 5.82 & 5.97 \\ 
\hline 4 & 5.89 & 5.76 & 5.33 & 5.66 \\
\hline 5 & 5.89 & 5.76 & 5.82 & 5.82 \\
\hline 6 & 5.89 & 5.33 & 5.82 & 5.68 \\
\hline 7 & 6.2 & 5.76 & 5.33 & 5.76 \\
\hline 8 & 6.2 & 5.76 & 5.82 & 5.93 \\
\hline 9 & 6.2 & 5.33 & 5.82 & 5.78 \\
\hline 10 & 5.76 & 5.33 & 5.82 & 5.64 \\
\hline
\end{tabu}

As you can see nothing really different between the two except an extra column. I did try to paste values in from excel, but I deleted them out and instead entered the data manually, but still getting the same errors. Any help would be appreciated

  • 3
    Remove the & in \multicolumn{5}{|l|}{List of Sample Values & Calculated Sample Means}, i.e. it needs to become \multicolumn{5}{|l|}{List of Sample Values Calculated Sample Means}. (On this site there is also an almost religious support of booktabs, so maybe you want to change your confession ... ;-) – Schrödinger's cat Sep 26 '19 at 2:27
  • Again done over by a simple important character I forgot to escape. New pair of eyes was useful. Thanks for your help. – dc3rd Sep 26 '19 at 3:53
  • You might also want to replace tabu with tabular since you don't use tabu`s X type column anyways. – leandriis Sep 26 '19 at 5:33
1

Assuming that you actually want to print a & in the multicolumn, you might want to use \& instead of & as shown in the following example. I have also replaced tabu with tabular since you anyways did not use tabu's X type column. I also added a second variant using booktabs as well as makecell and siunitx:

enter image description here

\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{makecell}
\renewcommand{\theadfont}{}

\begin{document}

\begin{tabular}{| l | l | l | l | l |}
\hline
\multicolumn{5}{|l|}{List of Sample Values \& Calculated Sample Means} \\
\hline
\hline Sample Number & Entry 1 & Entry 2 & Entry 3 & Sample Mean \\
\hline 1 & 5.89 & 6.2 & 5.76 & 5.95 \\
\hline 2 & 5.89 & 6.2 & 5.33 & 5.80 \\  
\hline 3 & 5.89 & 6.2 & 5.82 & 5.97 \\ 
\hline 4 & 5.89 & 5.76 & 5.33 & 5.66 \\
\hline 5 & 5.89 & 5.76 & 5.82 & 5.82 \\
\hline 6 & 5.89 & 5.33 & 5.82 & 5.68 \\
\hline 7 & 6.2 & 5.76 & 5.33 & 5.76 \\
\hline 8 & 6.2 & 5.76 & 5.82 & 5.93 \\
\hline 9 & 6.2 & 5.33 & 5.82 & 5.78 \\
\hline 10 & 5.76 & 5.33 & 5.82 & 5.64 \\
\hline
\end{tabular}

\bigskip

\begin{table}[hb]
\centering
\caption{List of Sample Values \& Calculated Sample Means}
\begin{tabular}{S[table-format=2] *{4}{S[table-format=1.2]}}
\toprule
{\thead{Sample\\ Number}} & {\thead{Entry 1}} & {\thead{Entry 2}} & {\thead{Entry 3}} & {\thead{Sample\\ Mean}} \\
\midrule
1 & 5.89 & 6.2 & 5.76 & 5.95 \\
2 & 5.89 & 6.2 & 5.33 & 5.80 \\  
3 & 5.89 & 6.2 & 5.82 & 5.97 \\ 
4 & 5.89 & 5.76 & 5.33 & 5.66 \\
5 & 5.89 & 5.76 & 5.82 & 5.82 \\
\addlinespace
6 & 5.89 & 5.33 & 5.82 & 5.68 \\
7 & 6.2 & 5.76 & 5.33 & 5.76 \\
8 & 6.2 & 5.76 & 5.82 & 5.93 \\
9 & 6.2 & 5.33 & 5.82 & 5.78 \\
10 & 5.76 & 5.33 & 5.82 & 5.64 \\
\bottomrule
\end{tabular}
\end{table}

\end{document}
|improve this answer|||||
  • That's very pretty actually. To comment on tabular for whatever reason it was not registering on my editor. Perhaps it was other errors that may have messed it up. Thank you for this assistance. Something new I've learned. – dc3rd Sep 26 '19 at 17:55

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.