I have two tables in my document but when I compile I get the error message
Something's wrong--perhaps a missing \item. \end{tabularx}
When compiling the document with only one table there is no problem. When compiling document with both tables there is an error message but I can see both tables.
It looks like enumerate
can cause problems. I have tried to follow suggestions from TEX link but with no success.
Can someone suggest a way to resolve the error please?
MWE:
\documentclass[a4paper,12pt]{article}
\usepackage{color}
\usepackage{graphicx, epstopdf}
\usepackage[british]{babel}
%\usepackage{gensymb}
\usepackage[section]{placeins}%Allows you to permanently fix figures.
\usepackage{titleps}%fancy page borders?
\usepackage[left=2.5cm, right=2.5cm, top=3.5cm, bottom=3.5cm]{geometry}%this changes the page geometry i.e. margins left, right, top and bottom
%\usepackage{caption}
\usepackage{microtype}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{SIunits}
\usepackage{mathptmx}
\usepackage{tabularx}
\usepackage{booktabs,caption, makecell}
\usepackage{pdflscape,afterpage}
\onehalfspacing
\usepackage{geometry}
\usepackage{booktabs, makecell, ltablex}
\usepackage{caption}
\renewcommand\theadfont{\small\bfseries}
\renewcommand\tabularxcolumn[1]{m{#1}}
\usepackage[usestackEOL]{stackengine}
\usepackage[table]{xcolor}
\usepackage{pdflscape,afterpage}
\usepackage{enumitem} % <--- added
\usepackage{etoolbox} % <--- added
\AtBeginEnvironment{table}{%
\setlist[enumerate]{nosep, % <--- added
topsep = 0pt,
partopsep = 0pt,
leftmargin = * ,
before = \vspace{-0.6\baselineskip},
after = \vspace{-\baselineskip}
}}
\begin{document}
\begin{table}[ht]
\caption{Cognitive walkthrough goals, tasks and actions}
\label{table:comparison of techniques}
\small
\begin{tabularx}{\linewidth}{@{}
X
>{\centering\arraybackslash}X % content of `X` column is now centered
X
@{}}
\toprule
\thead{\textbf{Goal}}& \thead{\textbf{Task}} & \thead{\textbf{Action}} \\
\midrule
Evaluate the ease in which users can join projects
& Access and account set up
& \begin{enumerate}
\item Teast A: Video provides a powerful way to help you prove your point.
Test B: Video provides a powerful way to help you prove your point.
\item Video provides a powerful way to help you prove your point.
\end{enumerate} \\
\addlinespace
Evaluate the ease in learning to map
& Learning how to map
& Read tutorial \\
\addlinespace
Contribute data
& Contributing data by classifying maps
& \begin{enumerate}
\item Video provides a powerful way to help you prove your point.
\item Test A: Video provides a powerful way to help you prove your point.
Test B: Video provides a powerful way to help you prove your point.
\item Video provides a powerful way to help you prove your point.
\end{enumerate} \\
\addlinespace
Evaluate if the user likes using the application and whether they like using it
& -- & -- \\
\bottomrule
\end{tabularx}%
\end{table}
\begin{landscape}% Landscape page
\small
\setlength\extrarowheight{2pt}
\begin{tabularx}{\linewidth}{
>{\columncolor{red!30}} l
*{3}{X}X@{}
}\caption{}
%\label{table:comparison of techniques}
\\
\Xhline{1pt}
\multicolumn{1}{c}{\cellcolor{red!30}}
&\bfseries{Is the effect of the current action the same as the user's goals?}{\cellcolor{red!30}} &\bfseries{Is the action visible?}{\cellcolor{red!30}}
& \bfseries{Will the user recognise the action as the right one?}{\cellcolor{red!30}} &\multicolumn{1}{>{\columncolor{red!30}[6pt][0pt]\bfseries}c@{}}{\Centerstack{Will the user understand \\ the feedback?}} \\
\Xhline{0.25pt}
\endfirsthead
\Xhline{1pt}
% \rowcolor{red!30}
\multicolumn{1}{c}{\cellcolor{red!30}}
&\bfseries{Is the effect of the current action the same as the user's goals?} &\bfseries{Is the action visible?}
& \bfseries{Will the user recognise the action as the right one?} &\multicolumn{1}{>{\bfseries}c@{}}{\Centerstack{Will the user understand \\ the feedback?}} \\
\Xhline{0.25pt}
\endhead
\Xhline{0.25pt}
\endfoot
\Xhline{1pt}
\endlastfoot
\rowcolor{black}
\multicolumn{5}{l}{\textcolor{white}{\bfseries Task 1 - access and account set up}} \\
Heading
& TEXT.
& TEXT.
& TEXT.
& TEXT. \\
\Xhline{0.25pt}
Heading
& TEXT.
& TEXT.
& TEXT.
& TEXT. \\
\rowcolor{black}
\multicolumn{5}{l}{\textcolor{white}{\bfseries Task 2 - learning how to map}} \\*
Heading
& TEXT.
& TEXT.
& TEXT.
& TEXT. \\
\rowcolor{black}
\multicolumn{5}{l}{\textcolor{white}{\bfseries Task 3 - contributing data by classifying maps}} \\
Heading
& TEXT.
& TEXT.
& TEXT.
& TEXT. \\
\Xhline{0.25pt}
Heading
& TEXT.
& TEXT.
& TEXT.
& TEXT. \\
\Xhline{0.25pt}
Heading
& TEXT.
& TEXT.
& TEXT.
& TEXT. \\
\end{tabularx}%
\end{landscape}
\end{document}
Thanks in advance!