7

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?

2
  • Welcome to TeX.SX! \begin{table}...\end{table} around what you have will make your table a float which thus will not necessarily appear at exactly the point where it appears in your code, but at a place TeX feels it fits - look for float placement here. Also, what you want is produced by \caption{Table Description}, rather than by \label{..} which is used for references to the table.
    – greyshade
    Nov 20, 2014 at 13:39
  • @greyshade Perfect, I was able to add both the caption and the label for future references. Now I'm just going to have to get into float to place it where I want, or find out about referencing elements later in the text but I already found a question. Thank you very much! Nov 20, 2014 at 14:39

1 Answer 1

10

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .