# Problems with labels inside a floating with a table

I have this strange problem with the labels inside the floating that contains a table. For my first table I put the label inside the floating area, then I added the cross reference somewhere in the text. The problem is that when I created the pdf this cross reference showed number 2, when the table is the number 1. But something even more strange happen later, It didn't matter if I had created different labels for different tables, all the cross references in the pdf showed number 2 and not the correct value according with table referenced

 % Vista preliminar del código fuente

%% Do not edit unless you really know what you are doing.
\documentclass[a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{array}
\usepackage{multirow}
\usepackage{setspace}
\onehalfspacing

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth

%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

\makeatother

\usepackage{babel}
\begin{document}
\setcounter{section}{1}

\section{\noindent evolution}

\begin{onehalfspace}
\noindent {\large This is summarized in the Table \ref{Laws}.}{\large \par}

\noindent {\large }
\begin{table}[h]
{\large }%
\begin{tabular}{|>{\centering}p{0.04\textwidth}|>{\centering}p{0.05\textwidth}|}
\hline
\multirow{1}{0.04\textwidth}{\textbf{No. }} & \textbf{Year}\tabularnewline
\hline
I & 1974\tabularnewline
\hline
II & 1974\tabularnewline
\hline
\end{tabular}{\large                                            }{\large \par}

{\large \caption{Law of evolution}
}{\large \par}

\label{Laws}
\end{table}
{\large \par}
\end{onehalfspace}

\begin{onehalfspace}

\subsection{\noindent The study }
\end{onehalfspace}

\begin{onehalfspace}
\noindent {\large Table \ref{paul} summarized the hypothesis.}{\large \par}

\noindent {\large }
\begin{table}[h]
{\large }%
\begin{tabular}{|c|>{\raggedright}m{0.35\textwidth}|}
\hline
\textbf{Number} & \textbf{Hypothesis}\tabularnewline
\hline
1 & Open \tabularnewline
\hline
\end{tabular}{\large \par}

{\large \caption{Hypothesis}
}{\large \par}

\label{paul}
\end{table}
{\large \par}
\end{onehalfspace}

{\large See Table \ref{summary}.}{\large \par}

{\large }
\begin{table}[h]
{\large }%
\begin{tabular}{|c|c|}
\hline
\textbf{\small Law} & \textbf{\small Name}\tabularnewline
\hline
I & Continuing change\tabularnewline
\hline
\end{tabular}{\large \par}

{\large \caption{Summary}
}{\large \par}

\label{summary}
\end{table}
{\large \par}

\subsection{Status.}

{\large Look table \ref{H}.}{\large \par}

{\large }
\begin{table}[h]
{\large }%
\begin{tabular}{|>{\raggedright}p{0.13\textwidth}|>{\raggedright}p{0.15\textwidth}|}
\hline
\textbf{Validated laws} & \textbf{Invalidated laws}\tabularnewline
\hline
I, VI & II, III, IV, V\tabularnewline
\hline
I, VI & II, III, IV, V\tabularnewline
\hline
\end{tabular}{\large \par}

{\large \caption{Studies}
}{\large \par}

{\large \label{H}}
\end{table}

\end{document}


With this I got these results: For table 1 the cross references indicated number 2 For table 2 the cross references indicated number 2 For table 3 the cross references indicated number 2 For table 4 the cross references indicated number 2.2

Where did I make a mistake?

Thanks

-
You have to add the label either inside or after the caption, did you do that? If the label is placed before the caption it picks up the wrong number. – Torbjørn T. Sep 14 '13 at 10:03
I have put and image to illustrate the problem. – user2343521 Sep 14 '13 at 10:24
Can you trim the document down to the minimum showing the problem, and edit the question to include the exported LaTeX source code? – Torbjørn T. Sep 14 '13 at 12:24
@TorbjørnT. Watching the code the only difference that I can see respect to one file that works is that at the end of the cross reference in the document appears this {\large \par}: See Table} \ref{chain} (in the good one) and See Table \ref{Fernandez}.}{\large \par} (in the wrong one). Can be that? – user2343521 Sep 14 '13 at 12:50
I wouldn't think so, but can you add the complete code to your question? – Torbjørn T. Sep 14 '13 at 13:14

The problem is that when you do

{\large \caption{Law of software evolution }
}
\label{Laws}


the pair of braces around the caption 'hides' the caption number from the label, so that it refers to something else, in this case the previous section. I don't know exactly how you did that in LyX, but if you can change it to

\caption{Law of software evolution }
\label{Laws}


it should work fine.

### An unrelated comment, based on guesswork

From the code it looks like you've been trying to make the font size for the entire document larger by adding \large everywhere, and this is a rather bad idea. The default base font size is 10pt, if you go to Document --> Settings --> Fonts you can set the Base size to 11pt or 12pt, which will increase the size of all the text in your document.

If larger sizes are required, change the document class to article (more font sizes), which gives you more options for the base size.

-
A very minor point: If the document's basic font size is 10pt, then \large switches to 11pt, not 12pt. Were you maybe thinking of \Large? – Mico Sep 14 '13 at 16:52
@Mico I wasn't really thinking of what exact size \large refers to at all ... I'll change the text a bit. – Torbjørn T. Sep 14 '13 at 16:53
@Mico I think you're wrong however, according to texdoc latex2e and tex.stackexchange.com/a/24600/586 \large is 12pt when the base size is 10pt. – Torbjørn T. Sep 14 '13 at 16:59
Thanks, I stand corrected! The mistake arose because for the case of an 11pt base size (which is what I work with for my own work...), \large indeed bumps up the font size by only 10%, from 10.95 to 12. However, for base sizes of 10pt and 12pt, the relative increase from \large is definitely 20%! Clearly, I shouldn't have extrapolated from the 11pt case to the 10pt case... – Mico Sep 14 '13 at 17:05