I'm having an issue with cross reference using Lyx. I'm using threeparttable with cross reference inside a float. Although the table number is 1, the compiled file shows me "Table 2" when I cross reference it.
I read the following thread Combining threeparttable with cross references - LyX but the solution there doesn't apply to me because I'm not calling an external file.
I'm using Lyx 2.1.3, MiKTeX 2.9 and Windows 7.
Here is the TEX code:
% Preview source code
%% LyX 2.1.3 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{array}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{threeparttable}
\makeatother
\usepackage{babel}
\begin{document}
\section{Introduction}
Table \ref{stats_goods} provides some summary statistics about each
good.
\section{Empirical Analysis}
\clearpage
\begin{table}[p]
\begin{threeparttable}
\begin{centering}
\protect\caption{\textsc{Summary Statistics }\label{stats_goods}}
\par\end{centering}
\smallskip{}
\begin{centering}
\begin{tabular}{>{\centering}p{2.5cm}>{\centering}p{2.5cm}> {\centering}p{2.5cm}>{\centering}p{2cm}>{\centering}p{2cm}>{\centering}p{1.5cm}}
\hline
x & y & z & w & 1 & 2\tabularnewline
\hline
\hline
& & & & & \tabularnewline
& & & & & \tabularnewline
& & & & & \tabularnewline
& & & & & \tabularnewline
& & & & & \tabularnewline
\hline
\end{tabular}
\par\end{centering}
\begin{tablenotes}[para,flushleft]\footnotesize{Note: My note}\end{tablenotes} \end{threeparttable}
\end{table}
\end{document}
I appreciate any help!