I have been at this all day! It is not working for me. I am working on my thesis and in my chapter 3, subsection 3.3.1 my tables come up with \ref and caption and labels (in the correct order, caption first) as 3.1 (my section number). This is the case for the 12 tables I have in this chapter.
I have tried EVERYTHING (various packages, changing order, deleting .aux, .lot files, compiling 1000 times, running it line by line, searching through all the forums) and I don't get it. I must be doing something wrong! I am calling on your wisdom! I included here my preamble and my table (they are in a separate tex file since the main document "calls" the chapter 3.
Thank you for your help, I will forever grateful!!
Code: Select all
\documentclass[12pt,titlepage,twosided]{book}
\usepackage{amsmath}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{3}
\usepackage{setspace}
\doublespace
\usepackage[table]{xcolor}
\usepackage{url}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{rotating}
\usepackage{graphicx}
\usepackage{parskip}
\usepackage{natbib}
\usepackage{eso-pic}
\usepackage[top=1in, bottom=1.5in, left=1in, right=1in]{geometry}
\usepackage{array}
\usepackage{fancyhdr}
%\usepackage{showkeys} %This package allows me to find keys and labels I have inserted in my document. I will need to remove once I am completely done with the document.
\usepackage[compact]{titlesec}
\titlespacing{\section}{0pt}{1ex}{0.5ex}
\titlespacing{\subsection}{0pt}{0.5ex}{0ex}
\titlespacing{\subsubsection}{0pt}{0ex}{0ex}
\pagestyle{fancy}
\begin{document}
\mainmatter
\renewcommand{\chaptername}{}
\include{3/chapter3}
....
\subsection{Why? Results III \label{subsec: why}}
\begin{table} \footnotesize
\caption{Distribution \label{table: how } }
\vspace{0.5cm}
\begin{center}
\begin{tabular}{c c c}
\hline
\hline
\textbf{Observations} & \textbf{Number of patterns} & \textbf{Percentage$^b$ of observed} \\
\\
\hline
\hline
\\
\bf{1} & 2 & 2\\
\\
\bf{2} & 2 & 2\\
\\
\bf{3} & 2 & 2\\
\\
\bf{4} & 2 & 2\\
\hline
\bf{Total} & 2 & 100.0\\
\hline
\hline
\multicolumn{3}{l}{\scriptsize $^a$Codes includedr}\\
\multicolumn{3}{l}{\scriptsize $^b$Percentages have been rounded.}\\
\end{tabular}
\end{center}
\end{table}
....
\end{document}