I'm new to Latex and need to create some tables with captions. I looked at the examples available here: https://www.sharelatex.com/project/5aa15ef4ecc7bf1bc277d160
but when I try to use captions in my own code, the compiler throws the error LaTeX Error: \caption outside float.
This is my code:
\usepackage{tabu}
\begin{center}
\begin{tabular}{|p{0.4cm}||p{4.3cm}|p{4.3cm}|p{4.3cm}|}
\hline
Id & Inclusion/Exclusion & Description & Motivation \\ [0.5ex]
\hline\hline
X & X. & XX \\ [1ex]
\hline
\end{tabular}
\caption{Table 1: The criteria.} % Error here!
\label{table:1}
\end{center}
Also if I try to reference the table, like this:
The table \ref{table:1} is an example of referenced
The table referenced is displayed as number 3 even though I only have one single table.

\captionshould be in atableenviornment. also avoid using numbers in the\label(or the text of the caption) latex will assign a number automatically. – David Carlisle Mar 08 '18 at 17:36