[Tex/LaTex] Numbering tables with tabular

numberingtables

I'm really new to Latex and would need some help with some basic coding: I can't number this table (which I would just be Table 1 right now). \label{tab:Deactivation} is not working, if I place it after \begin{tabular}. If I place it right before the end vertical lines 1 and 2 get longer(!).
I tried using \begin{table} around {center} like I've seen done in the wikibook but it seems to push the table to the end of the document, right before the references.

\begin{center}
 \begin{tabular}{ |c|c|c| }
\hline 
Type & Formula & $C_i$  \\ \hline
 &  &  \\  
Series Reaction & $A \rightarrow R  \rightarrow P \downarrow $ & $C_r$ \\ 
&  &  \\ 
Parallel Reaction & $A \rightarrow R $; $ A \rightarrow P \downarrow $ & $C_a$  \\ 
&  &  \\ 
Side-by-side Reaction & $A \rightarrow R $; $ P \rightarrow P \downarrow $ & $C_p$  \\ 
&  &  \\ 
Multiple Mechanisms & $A \rightarrow R \rightarrow P \downarrow $ ; $ A \rightarrow P \downarrow $ & $C_a + C_r$  \\
&  &  \\\hline
\end{tabular}
 \end{center} 

I know I'm doing something wrong, but what?

Best Answer

If a table or figure should be placed as desired and not float away, it's better to drop the table or figure environment and use \captionof{table}{Title} to generate the legend for the table of figure. This will generate the correct numbering and a \label{} command can be used to refer to the entity as well.

\documentclass{article}

\usepackage{caption}

\usepackage{blindtext}

\begin{document}
\listoftables

\clearpage

\blindtext

And now for something completely different

\begin{center}
 \begin{tabular}{ |c|c|c| }
\hline 
Type & Formula & $C_i$  \\ \hline
 &  &  \\  
Series Reaction & $A \rightarrow R  \rightarrow P \downarrow $ & $C_r$ \\ 
&  &  \\ 
Parallel Reaction & $A \rightarrow R $; $ A \rightarrow P \downarrow $ & $C_a$  \\ 
&  &  \\ 
Side-by-side Reaction & $A \rightarrow R $; $ P \rightarrow P \downarrow $ & $C_p$  \\ 
&  &  \\ 
Multiple Mechanisms & $A \rightarrow R \rightarrow P \downarrow $ ; $ A \rightarrow P \downarrow $ & $C_a + C_r$  \\
&  &  \\\hline
\end{tabular}
\captionof{table}{My sophisticated table}\label{sophisticatedtable}
\end{center} 

\blindtext[2]

In table \ref{sophisticatedtable} on page \pageref{sophisticatedtable} we can see ...



\end{document}

enter image description here

Related Question