I have referenced an appendix table in the main text. Depending on where I put the label, I either
- Get an error message saying that the reference is undefined (and the main text reads 'Table ??')
- Reference the table using the name of the whole section, so it is 'Table B' not 'Table B1' (the table appears in section B of the appendix).
Can anyone let me know what I am doing wrong? Here is a MWE which illustrates the first case ('Table ??'):
\documentclass[12pt]{article}
\usepackage{amssymb, hyperref, amsmath,amsfonts, bm, eurosym,geometry,ulem,graphicx,caption,mathtools,natbib, xcolor,setspace,comment,footmisc,caption,pdflscape,subfigure,array, parskip, bbm, csquotes, multirow, booktabs,caption}
\usepackage[flushleft]{threeparttable}
\usepackage[toc,page]{appendix}
\graphicspath{ {./images/} }
\newcommand{\red}[1]{{\color{red} #1}}
\newcommand{\blue}[1]{{\color{blue} #1}}
\geometry{left=1.0in,right=1.0in,top=1.0in,bottom=1.0in}
\begin{document}
Here is some text. I will try to reference Table \ref{overview}
\clearpage
\setlength{\bibhang}{0pt}
\bibliographystyle{apalike}
\bibliography{bibliography.bib}
\newpage
\setcounter{table}{0}
\renewcommand{\thetable}{A\arabic{table}}
\setcounter{figure}{0}
\renewcommand{\thefigure}{A\arabic{figure}}
\begin{appendices}
\section{Proofs} \label{proofs}
Here are some proofs
\newpage
\section{Additional tables and figures} \label{tables_figures}
\setcounter{table}{0}
\renewcommand{\thetable}{B\arabic{table}}
\setcounter{figure}{0}
\renewcommand{\thefigure}{B\arabic{figure}}
\begin{center}
\begin{threeparttable}[h]
\begin{tabular}{cclcc}
\hline
\caption{Overview}\label{overview}
Moose & Rabbit & \hspace{3em}Deer & Elephant & Mango \\ \hline
1 & Yes & a & 10 & 18 \\
2 & Yes & b & 10 & 18 \\
3 & No & c & 10 & 10 \\
4 & No & d & 10 & 10 \\
5 & No & e & 9 & 10 \\
6 & No & e & 9 & 10 \\ \hline
\end{tabular}
\begin{tablenotes}
\footnotesize
\item \hspace{-0.2em}\textit{Notes}: Here are some notes...
\end{tablenotes}
\end{threeparttable}
\end{center}
\end{appendices}
\end{document}
Here is is a MWE which illustrates the second case ('Table B'):
\documentclass[12pt]{article}
\usepackage{amssymb, hyperref, amsmath,amsfonts, bm, eurosym,geometry,ulem,graphicx,caption,mathtools,natbib, xcolor,setspace,comment,footmisc,caption,pdflscape,subfigure,array, parskip, bbm, csquotes, multirow, booktabs,caption}
\usepackage[flushleft]{threeparttable}
\usepackage[toc,page]{appendix}
\graphicspath{ {./images/} }
\newcommand{\red}[1]{{\color{red} #1}}
\newcommand{\blue}[1]{{\color{blue} #1}}
\geometry{left=1.0in,right=1.0in,top=1.0in,bottom=1.0in}
\begin{document}
Here is some text. I will try to reference Table \ref{overview}
\clearpage
\setlength{\bibhang}{0pt}
\bibliographystyle{apalike}
\bibliography{bibliography.bib}
\newpage
\setcounter{table}{0}
\renewcommand{\thetable}{A\arabic{table}}
\setcounter{figure}{0}
\renewcommand{\thefigure}{A\arabic{figure}}
\begin{appendices}
\section{Proofs} \label{proofs}
Here are some proofs
\newpage
\section{Additional tables and figures} \label{tables_figures}
\setcounter{table}{0}
\renewcommand{\thetable}{B\arabic{table}}
\setcounter{figure}{0}
\renewcommand{\thefigure}{B\arabic{figure}}
\begin{center}
\begin{threeparttable}[h]
\begin{tabular}{cclcc}
\hline
\caption{Overview}
Moose & Rabbit & \hspace{3em}Deer & Elephant & Mango \\ \hline
1 & Yes & a & 10 & 18 \\
2 & Yes & b & 10 & 18 \\
3 & No & c & 10 & 10 \\
4 & No & d & 10 & 10 \\
5 & No & e & 9 & 10 \\
6 & No & e & 9 & 10 \\ \hline
\end{tabular}
\begin{tablenotes}
\footnotesize
\item \hspace{-0.2em}\textit{Notes}: Here are some notes...
\end{tablenotes}
\end{threeparttable}
\label{overview}
\end{center}
\end{appendices}
\end{document}
\caption
directive not occurring inside a LaTeX "float" -- the main examples of which aretable
andfigure
. Also,\caption
directives are never allowed insidetabular
environments. You need to (a) embed thethreeparttable
material in atable
environment and (b) place the\caption{Overview}
instruction immediately after\begin{threeparttable}
and before\begin{tabular}
.